Author
|
Topic: EZGUI 4.0 Pro Designer - Walk Through (part 5) (Tab control)
|
Chris Boss Administrator
|
posted 03-27-2007 12:57 PM
Part 5:Here is how you create a Tab control and define the controls on its tabs. It should first be noted, that you don't have to create a separate form for each tab, like other Designers. While you could do this if you wanted to (using EZGUI pages forms and the EZ_ShowPage command), the better way in EZGUI's designer is to use Layers. Layer zero (0) is considered the background layer. This is where you put your tab control. Each tab on the Tab control can be assigned a unique layer. In this example, we will create 3 tabs and use layers to 1 to 3 for the tabs. (1) Create your blank Form (2) Add a Tab control to your Form. (3) Define the Tab controls properties. (double click Tab control to display its property dialog) (4) Set the Layer setting to Layer #1 and create the controls you want for Tab 1 (Notice the listbox on the project palette window for layers) (5) Set the Layer setting to Layer #2 and create the controls you want for Tab 2 (Notice the listbox on the project palette window for layers) (6) Set the Layer setting to Layer #3 and create the controls you want for Tab 3 (Notice the listbox on the project palette window for layers) (7) Let's generate the code (8) Let's compile the program and run it
|
Chris Boss Administrator
|
posted 03-27-2007 01:01 PM
Here the code generated by the designer for this Tab control example:code:
' Portions: Copyright Christopher R. Boss, 2003 to 2006 , All Rights Reserved ! ' Registered EZGUI 4.0 users may use this code Royalty Free !' ' ====================================== ' [PROTECTED CODE] Do NOT Edit ! ' ====================================== ' #COMPILE EXE #DIM ALL ' This is helpful to prevent errors in coding #INCLUDE "C:\ezgui40pro\includes\ezgui40.inc" ' EZGUI Include file for Declares ' DECLARE FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG DECLARE SUB EZ_FORM1_Display(BYVAL Parent$) DECLARE SUB EZ_FORM1_Design() DECLARE SUB EZ_FORM1_ParseEvents(CID&, CMsg&, CVal&, Cancel&) DECLARE SUB FORM1_Events(CID&, CMsg&, CVal&, Cancel&) ' %FORM1_LABEL1 = 100 %FORM1_TEXT1 = 105 %FORM1_TEXT2 = 110 %FORM1_LABEL2 = 115 %FORM1_LABEL3 = 120 %FORM1_TEXT3 = 125 %FORM1_LABEL4 = 130 %FORM1_TEXT4 = 135 %FORM1_TAB1 = 140 ' DECLARE SUB FORM1_TEXT1_Events(MyID&, CMsg&, CVal&, Cancel&) DECLARE SUB FORM1_TEXT2_Events(MyID&, CMsg&, CVal&, Cancel&) DECLARE SUB FORM1_TEXT3_Events(MyID&, CMsg&, CVal&, Cancel&) DECLARE SUB FORM1_TEXT4_Events(MyID&, CMsg&, CVal&, Cancel&) DECLARE SUB FORM1_TAB1_Events(MyID&, CMsg&, CVal&, Cancel&) ' #INCLUDE "C:\ezgui40pro\includes\ezwmain.inc" ' EZGUI Include file for WinMain ' SUB EZ_Main(VerNum&) ' (PROTECTED) EZ_Reg %EZ_CUSTID,%EZ_REGNUM EZ_DefImageFolder "Graphics" EZ_AllowCommandEvents 0 EZ_DefFont 6, "Arial", 10, "V" EZ_DefFont 7, "Courier New", 10, "F" EZ_DefFont 8, "Times New Roman", 10, "V" EZ_DefFont 9, "Modern", 10, "V" EZ_DefSystemColor 32, 15 EZ_DefSystemColor 33, 5 EZ_DefSystemColor 34, 15 EZ_DefSystemColor 35, 24 EZ_DefColorL 36, &HB96FFF EZ_DefColorL 37, &H14AB9F EZ_DefColorL 38, &H1A64FF EZ_DefColorL 39, &HD2AACF EZ_DefColorL 40, &H1CD5E3 EZ_DefColorL 41, &HBC8943 EZ_DefColorL 42, &H6C6AB7 EZ_DefColorL 43, &HDD4489 IF Main_Initialize(VerNum&) THEN EZ_FORM1_Display "" END IF END SUB ' SUB EZ_DesignWindow(FormName$) ' (PROTECTED) SELECT CASE FormName$ CASE "FORM1" EZ_FORM1_Design CASE ELSE END SELECT END SUB ' SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&) ' (PROTECTED) SELECT CASE FormName$ CASE "FORM1" EZ_FORM1_ParseEvents CID&, CMsg&, CVal&, Cancel& CASE ELSE END SELECT END SUB ' ' ====================================== ' [USER ACCESSABLE CODE] You may Edit ! ' ====================================== ' FUNCTION Main_Initialize(BYVAL VerNum&) AS LONG LOCAL RV& RV&=1 FUNCTION=RV& END FUNCTION ' '<<BEGINFORM>> "FORM1" ' ' ====================================== ' [PROTECTED CODE] Do NOT Edit ! ' ====================================== ' SUB EZ_FORM1_Display(BYVAL Parent$) ' (PROTECTED) EZ_Color -1, -1 EZ_Form "FORM1", Parent$, "My First Tab control Dialog", 0, 0, 71.125, 29.75, "CZ" END SUB ' SUB EZ_FORM1_Design() ' (PROTECTED) LOCAL CText$ EZ_Color-1,-1 EZ_SetLayer 1 EZ_UseFont 4 EZ_Label %FORM1_LABEL1, 3, 7, 14, 1, "Product Name:", "C" EZ_Color-1,-1 EZ_UseFont 4 EZ_Text %FORM1_TEXT1, 18, 6.75, 47, 1.5, "", "EST" EZ_Color-1,-1 EZ_UseFont 4 EZ_Text %FORM1_TEXT2, 18, 10, 47, 5.5, "", "EST" EZ_Color-1,-1 EZ_UseFont 4 EZ_Label %FORM1_LABEL2, 5, 10, 11, 1, "Description:", "C" EZ_Color-1,-1 EZ_SetLayer 2 EZ_UseFont 4 EZ_Label %FORM1_LABEL3, 3, 7.5, 12.5, 1.5, "Comments:", "C" EZ_Color 0, 27 EZ_UseFont 4 EZ_Text %FORM1_TEXT3, 17, 7.5, 49.5, 17.75, "", "EMSTV" EZ_Color-1,-1 EZ_SetLayer 3 EZ_UseFont 4 EZ_Label %FORM1_LABEL4, 4, 7.5, 10, 1.25, "Notes:", "C" EZ_Color 0, 35 EZ_UseFont 4 EZ_Text %FORM1_TEXT4, 15.5, 7.25, 51.5, 12.25, "", "EMSTV" EZ_Color-1,-1 EZ_SetLayer 0 EZ_UseFont 1 EZ_TabControl %FORM1_TAB1, 2, 4, 67, 23, "Description|Comments|Notes", "!T" EZ_DisplayLayer "FORM1", 1, 0 OR %EZ_DECtrls END SUB ' SUB EZ_FORM1_ParseEvents(CID&, CMsg&, CVal&, Cancel&) ' (PROTECTED) SELECT CASE CID& CASE %EZ_Window FORM1_Events CID&, CMsg&, CVal&, Cancel& CASE %FORM1_TEXT1 FORM1_TEXT1_Events CID&, CMsg&, CVal&, Cancel& CASE %FORM1_TEXT2 FORM1_TEXT2_Events CID&, CMsg&, CVal&, Cancel& CASE %FORM1_TEXT3 FORM1_TEXT3_Events CID&, CMsg&, CVal&, Cancel& CASE %FORM1_TEXT4 FORM1_TEXT4_Events CID&, CMsg&, CVal&, Cancel& CASE %FORM1_TAB1 FORM1_TAB1_Events CID&, CMsg&, CVal&, Cancel& CASE ELSE FORM1_Events CID&, CMsg&, CVal&, Cancel& END SELECT END SUB ' ' ====================================== ' [USER ACCESSABLE CODE] You may Edit ! ' ====================================== ' SUB FORM1_Events(CID&, CMsg&, CVal&, Cancel&) SELECT CASE CID& CASE %EZ_Window SELECT CASE CMsg& CASE %EZ_Loading CASE %EZ_Loaded CASE %EZ_Started CASE %EZ_Close CASE ELSE END SELECT CASE ELSE END SELECT END SUB ' SUB FORM1_TEXT1_Events( MyID&, CMsg&, CVal&, Cancel&) SELECT CASE CMsg& CASE %EZ_Change CASE ELSE END SELECT END SUB ' SUB FORM1_TEXT2_Events( MyID&, CMsg&, CVal&, Cancel&) SELECT CASE CMsg& CASE %EZ_Change CASE ELSE END SELECT END SUB ' SUB FORM1_TEXT3_Events( MyID&, CMsg&, CVal&, Cancel&) SELECT CASE CMsg& CASE %EZ_Change CASE ELSE END SELECT END SUB ' SUB FORM1_TEXT4_Events( MyID&, CMsg&, CVal&, Cancel&) SELECT CASE CMsg& CASE %EZ_Change CASE ELSE END SELECT END SUB ' SUB FORM1_TAB1_Events( MyID&, CMsg&, CVal&, Cancel&) SELECT CASE CMsg& CASE %EZ_Change EZ_DisplayLayer "FORM1", CVal&, 0 OR %EZ_DECtrls CASE ELSE END SELECT END SUB ' '<<END ALL FORMS>> UnKnown Routines follow: #IF %EZ_NOSKIPCODE #ENDIF 'PARSE END '
| |