Advertisement
idsystems

CPP_RAD_Ejercicio46

Jun 21st, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. /* ej46_Toolbar
  2. Ejemplo del control Toolbar */
  3. #include <radc++.h>
  4.  
  5. Form  form1("Barras de Herramientas - RAD C++ Ejemplo");
  6. Label label("Toolbar's Opciones de Diseño",-1,100,120,200,20,form1);
  7. CheckBox _flat("Flat toolbar y botones",AUTO_ID,100,150,200,20,form1);
  8. CheckBox _divider("Agregar divisor en lo superior",AUTO_ID,100,180,200,20,form1);
  9.  
  10.  
  11. //create toolbar
  12. ToolBar tools(AUTO_ID,form1);
  13. //create toolbar button objects to track clicks
  14. ToolBarItem btn_exit, btn_about;
  15.  
  16. //create iconlist for toolbar
  17. IconList icl(RCP_SMALL);
  18.  
  19. //create some icon objects, IDI_XXXXX are predefined in system
  20. Icon icon1(IDI_APPLICATION);
  21. Icon icon2(IDI_EXCLAMATION);
  22. Icon icon3(IDI_HAND);
  23. Icon icon4(IDI_QUESTION);
  24.  
  25.  
  26. FormProcedure proc(FormProcArgs) {
  27.     ON_CLOSE() Application.close();
  28.    
  29.     ON_COMMAND_BY(btn_exit)
  30.         Application.close();
  31.    
  32.     ON_COMMAND_BY(btn_about)
  33.         form1.infoBox("RAD C++ Toolbar Ejemplo, Marzo 20, 2007.");
  34.        
  35.     ON_CHECKBOX_EVENT(_flat)
  36.         tools.flat = _flat.checked;
  37.    
  38.     ON_CHECKBOX_EVENT(_divider)
  39.         tools.divider = _divider.checked;
  40.    
  41.     //adjust toolbar when form is resized
  42.     ON_RESIZE()
  43.         tools.adjust();
  44.         //do not use this IF you want toolbar be on absolute position
  45.    
  46.  
  47.     return 0;
  48. }
  49.  
  50. rad_main()
  51.     form1.procedure = proc;
  52.  
  53.     //add icons to icon list
  54.     icl.add(icon1);
  55.     icl.add(icon2);
  56.     icl.add(icon3);
  57.     icl.add(icon4);
  58.  
  59.     //attach iconlist with toolbar        
  60.     tools.setIconList(icl);
  61.     tools.captions=true;
  62.    
  63.     //add buttons to toolbar
  64.     tools.add("Item 1",0,AUTO_ID); //second argument is icon id in iconlist
  65.     tools.add("Item 2",1,AUTO_ID);
  66.     btn_exit =tools.add("Salida"  ,2,AUTO_ID);
  67.     btn_about=tools.add("Acerca" ,3,AUTO_ID);
  68.    
  69.     _flat.checked=true;    
  70.     _divider.checked=true;
  71.    
  72. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement