|
EZ_DesignWindow
|
|
Callback Procedure Syntax:
This callback procedure is EZ_DesignWindow. EZGUI will send a request to this
procedure when it needs to design the window (Form) the first time. To make tracking
each individual Window easier, a window is called a Form and it is given a name. Each
Forms name (as defined in the EZ_Form command) is converted to all capitals by EZGUI
and is then passed back to your callback procedures so you can know which Form fired
the event.
The EZ_DesignWindow procedures purpose is just for designing a Form. It is
here that you define all the controls (ie. text boxes, scrollbars, comboboxes) that will be
on your Form. Such things as the colors and fonts for controls are defined before each
command that creates a control. The design window event is "always" sent to the
EZ_DesignWindow procedure for every Form, just one time when the Form is created. If
a Form is unloaded (destroyed) then it can be created again and the design window event
will occur again.
The FormName$ parameter is the name of the Form that needs to be designed
(you create controls on it). The form name will be converted to all Capital letters when it
is passed to this procedure.
Using the previous sample program, let's look at EZ_DesignWindow a little closer :
SUB EZ_DesignWindow(FormName$) ' (PROTECTED)
SELECT CASE FormName$
CASE "FORM1"
EZ_Form1_Design
CASE ELSE
END SELECT
END SUB
This procedure will parse out the requests to design a form to the appropriate
procedure for a Form. The FormName$ parameter always passes the Forms name in
uppercase letters.
Now let's look at the procedure for Form1 called by EZ_DesignWindow:
SUB EZ_Form1_Design() ' (PROTECTED)
LOCAL hMainMenu&, hDropMenu&, hSubMenu&
hMainMenu&=EZ_GetMenu("Form1", 0)
hDropMenu&=EZ_DefSubMenu( %FORM1_SELFILE, _
"&Select File", "")
EZ_SaveMenu "Form1", 1, hDropMenu&
EZ_SetSubMenu hMainMenu& , %FORM1_FILE, hDropMenu&
EZ_AddMenuItem hDropMenu&, %FORM1_QUIT, 0, "E&xit", ""
' ------------------------------------------------
EZ_Color 0, 30
EZ_UseIFont "Arial Black", 18,"BV"
EZ_Label %FORM1_LABEL1, 3, 1.5, 44, 5, _
"Hello there !| Welcome to EZGUI 4.0 !", "CF"
' -----------------------------------------------
EZ_Color-1,-1
EZ_UseFont 4
EZ_Button %FORM1_RBUTTON, 3, 8.25, 17.5, 2.25, _
"Regular Button", "T"
' -----------------------------------------------
EZ_Color 0, 25
EZ_UseFont 4
EZ_ODButton %FORM1_BUTTON2D, 3, 12, 17.5, 2.25, _
"2D Colored Button", "2T"
' -----------------------------------------------
EZ_Color 0, 25
EZ_UseFont 4
EZ_ODButton %FORM1_BUTTON3D, 27.5, 8.25, 17, 2.25, _
"3D Colored Button", "T"
' -----------------------------------------------
END SUB
You will notice that both of these procedures are protected. This means then you
should not edit them, since they were created by the Visual Designer and should only be
changed by the Visual Designer (when using the Smart Parser). When a Form is created
(EZ_Form command) then EZGUI will generate an event to have the form designed.