Advertisement
idsystems

CPP_RAD_Ejercicio44

Jun 21st, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. /* ej44_StatusBar
  2. Ejemplo del control StatusBar */
  3. #include <radc++.h>
  4.  
  5. Form      form1("StatusBar - RAD C++ Ejemplo");
  6. StatusBar status("Parte 1 texto;Parte 2 texto",AUTO_ID,form1,2);  //2 parts
  7.  
  8. Label     lbl1("Introduzca texto para las partes, delimite con ';'",-1,100,35,200,20,form1);
  9. TextBox   txt1("Part 1 text;Part 2 text",AUTO_ID,100,60,200,20,form1);
  10.  
  11. Label     lbl2("Introduzca nuevo numero de partes",-1,100,110,200,20,form1);
  12. NumberBox txt2("2",AUTO_ID,100,135,50,20,form1);
  13.  
  14. Label     lbl3("Introduzca parte # para mostrar",-1,100,165,200,20,form1);
  15. NumberBox txt3("0",AUTO_ID,100,185,50,20,form1);
  16.  
  17. FormProcedure proc(FormProcArgs) {
  18.     ON_CLOSE() Application.close();    
  19.    
  20.     ON_RESIZE() { //when form is resized, adjust the statusbar
  21.         status.adjust();
  22.     }
  23.    
  24.     ON_TEXT_CHANGED(txt1) { //change text of parts
  25.         status.setText(txt1.text);
  26.     }
  27.    
  28.     ON_TEXT_CHANGED(txt2) {
  29.         int num = val(txt2.text);
  30.         if(num > 0) {
  31.             status.setParts(num); //set new number of parts
  32.             //NOTE: application can crash if number of new parts is supplied ZERO
  33.            
  34.             status.setText(txt1.text); //remake popout effects
  35.         }  
  36.     }  
  37.     ON_TEXT_CHANGED(txt3) {
  38.         status.popOut(val(txt3.text),true);  
  39.     }
  40.    
  41.     return 0;
  42. }
  43.  
  44. rad_main()
  45.  
  46.     form1.procedure = proc;
  47.    
  48.     txt2.setLimit(2);
  49.  
  50.     //1.You can use single string having values delimitted with ';' semicolin
  51.     //status.setText("Part 1 text;Part 2 text");
  52.    
  53.     //2. Second way to set text in statusbar parts
  54.     //StringList list;
  55.     //list.add("Part 1 text");
  56.     //list.add("Part 2 text");
  57.     //status.setText(list);
  58.    
  59.     //3.OR you can set text of certain part individually as:
  60.     //status.setText(0,"some text");
  61.    
  62.     String part1_text = status[0]; //access the part 1 text, ZERO based index
  63.    
  64. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement