Advertisement
idsystems

CPP_RAD_Ejercicio39

Jun 21st, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. /* ej39_HorizontalSlider
  2. Ejemplo para mostrar el control Slider de manera horizontal */
  3. #include <radc++.h>
  4.  
  5. Form form1("Slider Horizontal - RAD C++ Ejemplo");
  6.  
  7.  
  8. Label label1("Por favor arrastre y mueva el slider con el raton",-1,100,20 ,200,30,form1);
  9. Track track(AUTO_ID,100,60,200,30,form1); //create trackbar / slider
  10.  
  11. Label label2("Introduzca el numero de ticks",-1,100,110 ,200,20,form1);
  12. NumberBox txt_num("15",AUTO_ID,100,135 ,200,20,form1);
  13.  
  14. Label label3("Introduzca una nueva posicion",-1,100,165 ,200,20,form1);
  15. NumberBox txt_pos("0",AUTO_ID,100,190 ,200,20,form1);
  16.  
  17.  
  18.  
  19. FormProcedure proc(FormProcArgs) {
  20.     ON_CLOSE() Application.close();
  21.    
  22.     //user moved trackbar
  23.     ON_TRACK_CHANGE(track) {      
  24.         int pos = track.position; //get track position
  25.         label1.caption = str(pos);
  26.     }
  27.    
  28.     ON_TEXT_CHANGED(txt_num) {
  29.         //set new number of ticks
  30.         track.ticks = val(txt_num.text);
  31.     }
  32.  
  33.     ON_TEXT_CHANGED(txt_pos) {
  34.         //set new number position
  35.         track.position = val(txt_pos.text);
  36.     }
  37.      
  38.     return 0;
  39. }
  40.  
  41. rad_main()
  42.  
  43.     form1.procedure = proc;
  44.    
  45.     //set minmum and maximum range
  46.     track.minRange = -15;
  47.     track.maxRange =  15;
  48.  
  49.  
  50. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement