Advertisement
idsystems

CPP_RAD_Ejercicio40

Jun 21st, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. /* ej40_VerticalSlider
  2. Ejemplo del mismo control Track pero ahora vertical */
  3. #include <radc++.h>
  4.  
  5. Form form1("Slider Vertical - RAD C++ Ejemplo");
  6.  
  7. Label label1("Por favor arrastre y mueva el slider con el raton",-1,100,20 ,200,30,form1);
  8. //create trackbar / slider
  9. Track track(AUTO_ID,100,60,30,150,form1,0,true,true,false,true);
  10. //check documentation for track constructor arguments,
  11. //8th argument is default number of ticks
  12. //12th argument is bool _vertical, we passed true to make it vertical
  13.  
  14. Label label2("Introduzca nuevo numero de ticks",-1,150,60 ,150,20,form1);
  15. NumberBox txt_num("15",AUTO_ID,150,85 ,150,20,form1);
  16.  
  17. Label label3("Introduzca nueva posicion",-1,150,155 ,150,20,form1);
  18. NumberBox txt_pos("0",AUTO_ID,150,180 ,150,20,form1);
  19.  
  20. FormProcedure proc(FormProcArgs) {
  21.     ON_CLOSE() Application.close();
  22.    
  23.     //user moved trackbar
  24.     ON_TRACK_CHANGE(track) {      
  25.         int pos = track.position; //get track position
  26.         label1.caption = str(pos);
  27.     }
  28.    
  29.     ON_TEXT_CHANGED(txt_num) {
  30.         //set new number of ticks
  31.         track.ticks = val(txt_num.text);
  32.     }
  33.  
  34.     ON_TEXT_CHANGED(txt_pos) {
  35.         //set new number position
  36.         track.position = val(txt_pos.text);
  37.     }
  38.      
  39.     return 0;
  40. }
  41.  
  42. rad_main()
  43.  
  44.     form1.procedure = proc;
  45.    
  46.     //set minmum and maximum range
  47.     track.minRange = -15;
  48.     track.maxRange =  15;
  49.  
  50. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement