Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej06_ColorBoton
- Este ejemplo es para mostrar como cambiar el color a
- un control de boton, asi como usar los controles de label
- caja numerica y algunos eventos */
- #include <radc++.h>
- Form form1("Color de boton - RAD C++ Ejemplo");
- ColorButton col_btn(AUTO_ID,100,60,200,50,form1,0xD17878);
- //0xD17878 is default color in hex which equals to = 13727864
- Label label1("Cambie padding:",-1,100,130,100,20,form1);
- NumberBox pad_txt("5",AUTO_ID,100,150,50,25,form1);
- Label label2("Cambie Color:",-1,200,130,100,20,form1);
- NumberBox col_txt("13727864",AUTO_ID,200,150,100,25,form1);
- FormProcedure form1Proc(FormProcArgs) {
- ON_CLOSE() Application.close(); //close application when form is closed
- ON_COMMAND_BY(col_btn) { //button clicked
- COLORREF last_color = col_btn.color;
- if(form1.selectColor(last_color)) {
- col_btn.color = last_color;
- col_txt.text = str(last_color);
- }
- }
- ON_TEXT_CHANGED(pad_txt) { //user entered new padding value
- col_btn.padding = val(pad_txt.text);
- }
- ON_TEXT_CHANGED(col_txt) { //user entered new color value
- col_btn.color = val(col_txt.text);
- }
- return 0;
- }
- rad_main()
- form1.procedure = form1Proc;
- pad_txt.setLimit(2); //limit number of digits for numberbox pad_txt
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement