Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej23_TanControl
- Para mostrar el uso del control Tab */
- #include <radc++.h>
- Form form1("Tab Control - RAD C++ Ejemplo");
- //create new tab control
- Tab t("",AUTO_ID,0,0,form1.cwidth,form1.cheight,form1);
- //add 3 pages to tab control
- TabPage p1=t.addPage("Pag1");
- TabPage p2=t.addPage("Pag2");
- TabPage p3=t.addPage("Pag3");
- //4 controls to attach with tab pages
- Form form2("Hijo de Tab",0,0,100,100,RCP_NONE,true,true,false,false,false,form1,true,0);
- Button b1 ("Boton para tab1", AUTO_ID,0,10,100,50,form2);
- TableView b12("1", AUTO_ID,0,70,100,100,form2);
- Button b2("para tab 2", AUTO_ID,0,0,10,10,form1);
- RichTextBox b3 ("Soy tab 3 anclado a objeto", AUTO_ID,0,0,10,10,form1);
- FormProcedure childformproc(FormProcArgs) {
- ON_RESIZE() {
- b1.fitToWidth();
- b12.fitToWidth();
- }
- ON_COMMAND_BY(b1) form1.msgBox("btn1");
- ON_COMMAND_BY(b12) form1.msgBox("btn2");
- return 0;
- }
- FormProcedure proc(FormProcArgs) {
- ON_CLOSE() Application.close();
- //now check of p1 and p2 of tabcontrol 't' are selected
- //Even if not processing events, just put semi collin after,
- //but make sure to write them down to show attached Objects properly
- ON_TAB_SELECT(t,p1); //t is tab control p1 is tab page
- ON_TAB_SELECT(t,p2);
- ON_TAB_SELECT(t,p3);
- ON_RESIZE() { //when form is resized
- //resize tab control and fit to entire form area
- t.fitExact();
- //also resize and adjust attached objects of pages, each individually
- p1.adjust();
- p2.adjust();
- p3.adjust();
- }
- return 0;
- }
- rad_main()
- form1.procedure = proc;
- form2.procedure = childformproc;
- b12.addColumn("Nombre");
- b12.addColumn("Email");
- b12.addColumn("Edad");
- b12.addRow("abcd");
- b12.addRow("abcd");
- b12.addRow("abcd");
- b12.addRow("abcd");
- p1.attachObject(form2);
- p2.attachObject(b2);
- p3.attachObject(b3);
- //since p1 is first tab, so it's contents need to be adjusted manually (just once)
- p1.adjust();
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement