Advertisement
idsystems

CPP_RAD_Ejercicio06

May 17th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. /* ej06_ColorBoton
  2. Este ejemplo es para mostrar como cambiar el color a
  3. un control de boton, asi como usar los controles de label
  4. caja numerica y algunos eventos */
  5.  
  6. #include <radc++.h>
  7.  
  8. Form        form1("Color de boton - RAD C++ Ejemplo");
  9. ColorButton col_btn(AUTO_ID,100,60,200,50,form1,0xD17878);
  10. //0xD17878 is default color in hex which equals to = 13727864
  11.  
  12. Label       label1("Cambie padding:",-1,100,130,100,20,form1);
  13. NumberBox   pad_txt("5",AUTO_ID,100,150,50,25,form1);
  14.  
  15. Label       label2("Cambie Color:",-1,200,130,100,20,form1);
  16. NumberBox   col_txt("13727864",AUTO_ID,200,150,100,25,form1);
  17.  
  18.            
  19. FormProcedure form1Proc(FormProcArgs) {
  20.     ON_CLOSE()  Application.close(); //close application when form is closed
  21.    
  22.     ON_COMMAND_BY(col_btn) { //button clicked
  23.         COLORREF last_color = col_btn.color;
  24.         if(form1.selectColor(last_color)) {
  25.             col_btn.color = last_color;
  26.             col_txt.text = str(last_color);                                          
  27.         }
  28.     }
  29.    
  30.     ON_TEXT_CHANGED(pad_txt) { //user entered new padding value
  31.         col_btn.padding = val(pad_txt.text);
  32.     }
  33.  
  34.     ON_TEXT_CHANGED(col_txt) { //user entered new color value
  35.         col_btn.color = val(col_txt.text);
  36.     }
  37.  
  38.     return 0;
  39. }
  40.  
  41. rad_main()
  42.  
  43.         form1.procedure = form1Proc;
  44.         pad_txt.setLimit(2); //limit number of digits for numberbox pad_txt
  45.    
  46. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement