UBBFriend: Email This Page to Someone!
  Computer Workshop User Forums
  Beginners Startup Tutorials (Read Only)
  Where to Start ? (EZGUI 3.0)

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Where to Start ? (EZGUI 3.0)
Chris Boss
Administrator
posted 09-01-2005 03:54 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
The best way to start using EZGUI 3.0 is to use the Visual Designer and do the following:

In the Designer:

I. Create a Form

(1) Create a New Form.

(2) Double click the Form to display the
Form Properties Dialog. Uncheck the
checkbox which says
"Display Menu Below:".
Click Apply button.

(3)Save the Form
(call it "myfirstform.fmz")

II. Build Application

(1) Select the "Build Multi-Form App"
option from Menu (under Files)

(2) In the Build Multi-Form App Dialog
click the Browse Form Files button
and select the form you saved
("myfirstform.fmz")

(3) Click the "Build Application" button

(4) In Code Generation Dialog click the
"Generate Code" button.

III. Floating Toolbar

(1) Make sure your PB IDE is running
(or whatever code editor you use)

(2) On the floating toolbar, click the
icon that looks like a little Man
(skeleton). This copies the skeleton
code (entire app) into the
clipboard.

(3) Paste the code from clipboard into
your code editor.

IV. Compile Application

You can manually edit the code in the
program at this point to add event
code. Once you add event code you can
compile your app.


The reason for starting with a blank form for the first app's form is so you can see the core procedures in an EZGUI application.

Here is the generated code:

code:



' *************************************************************************************
' Code Generated by EZGUI Visual Designer 3.01
' Portions: Copyright Christoper R. Boss, 2003
' All Rights Reserved !
' Registered EZGUI 3.0 users may use this code Royalty Free !
' *************************************************************************************
#COMPILE EXE
#DIM ALL ' This is helpful to prevent errors in coding
' --------------------
#INCLUDE "C:\ezgui30\includes\ezgui30.inc" ' EZGUI Include file for Declares
' --------------------
' *************************************************************************************

' *************************************************************************************
' Application Constants and Declares
' *************************************************************************************
DECLARE SUB Form1_Display(BYVAL Parent$)
DECLARE SUB Form1_Design()
DECLARE SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
' ------------------------------------------------

' ------------------------------------------------


' *************************************************************************************
' Application Global Variables and Types
' *************************************************************************************

' Note: Do NOT change the names of the EZGUI Callback Procedures !

' --------------------
#INCLUDE "C:\ezgui30\includes\ezwmain.inc" ' EZGUI Include file for WinMain
' --------------------
' *************************************************************************************
' EZGUI Program Control Functions
' *************************************************************************************

SUB EZ_Main(VerNum&)
EZ_DefFont 6, "Arial", 14, "L+V"
EZ_DefFont 7, "Courier New", 16, "BF"
EZ_DefFont 8, "Times New Roman", 16, "L+V"
EZ_DefFont 9, "Arial Black", 14, "L+V"
Form1_Display ""
END SUB

' -------------------------------------------------------------------------------------

SUB EZ_DesignWindow(FormName$)
' - NOTE: EZGUI passes back Form Name in uppercase letters
SELECT CASE FormName$
CASE "FORM1"
Form1_Design
CASE ELSE
END SELECT
END SUB

' -------------------------------------------------------------------------------------

SUB EZ_Events(FormName$, CID&, CMsg&, CVal&, Cancel&)
' - NOTE: EZGUI passes back Form Name in uppercase letters
SELECT CASE FormName$
CASE "FORM1"
Form1_Events CID&, CMsg&, CVal&, Cancel&
CASE ELSE
END SELECT
END SUB

' -------------------------------------------------------------------------------------


' *************************************************************************************
' Put Your Code Here
' *************************************************************************************

SUB Form1_Display(BYVAL Parent$)
EZ_Color -1, -1
EZ_Form "FORM1", Parent$, "Your Dialog", 0, 0, 53, 20, "CK"
END SUB
' ------------------------------------------------

GLOBAL Form1_FF&

SUB Form1_Design()
LOCAL FF&
'---------------------------------------------------------------
FF& = 9 ' - Offset for Font Numbers
Form1_FF& = FF& ' Global for ODButtons Draw code
'---------------------------------------------------------------
' Display Layers 0 and 1
EZ_DisplayLayer "FORM1", 1, 0 OR %EZ_DECtrls
END SUB
' ------------------------------------------------

SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&)
SELECT CASE CID&
CASE %EZ_Window
IF CMsg&=%EZ_Close THEN
END IF
CASE ELSE
END SELECT
END SUB
' -----------------------------------------------


Note: Make sure the EZGUI runtime DLL's are in the same folder as your applications source code. You can copy them using Windows Explorer.


Chris Boss
Administrator
posted 09-01-2005 03:55 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Now when building apps using EZGUI 3.0, you really need to fine tune the look and feel of your forms before you generate the code for the application. Try to anticipate all the forms you will need, plan them out well.

Once you have designed them you should then build the application code.

The purpose of building the first app without any controls is so you can see the code procedures of all EZGUI applications.

The three main procedures are:


EZ_Main
EZ_DesignWindow
EZ_Events

EZ_Main is where your application starts. It is only called once, by the EZGUI engine. It is equivilent to the PBMain procedure. At least one form must be displayed (by calling its display routine) in this procedure. Others can be displayed at any time (ie. during a button click of an existing form).

EZ_DesignWindow is where EZGUI requests that you design your form (add controls). The Visual Designer generates a separate SUB for each form, which is called from this procedure. Notice the SELECT CASE structure in EZ_DesignWindow. EZGUI passes the name of the Form that it needs designed. The form name is always in all capital letters when passed to this procedure.

Last is the EZ_Events procedure. This is where EZGUI sends all events for all forms. Again notice the SELECT CASE structure in this procedure. EZGUI passes 5 parameters to this procedure. You can parse out each forms event and call a separate SUB for each form (Designer generates this kind of code).

EZ_Events parameters:

Formname$ - Form which gets the event

CID& - ID of control on that form for which the event is for.

(If the event is for the form itself CID& equals %EZ_Window (a value of zero))

CMsg& - The EZGUI Event. This can be any of the available EZGUI event constants (ie. %EZ_Click)

CVal& - This parameter contains a unique value depending upon the event.

For example, the %EZ_Change event for a Tab control would pass the index of the selected tab in CVal&. Some events pass a pointer value which may be passed to other EZGUI commands specific to that event. A scrollbar would pass the current position in CVal& for its %EZ_Change event.

Cancel& - This paremeter is set to zero by default. If you set the variable to a non-zero value, it tells EZGUI to cancel the default action of the event. Only some events use this parameter. Most ignore it.


Chris Boss
Administrator
posted 09-01-2005 03:55 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Notice in the Generated code, that the Form has its own unique subroutine for its design code, display code and events.

The Designer always generates the names of these SUBs using the forms name plus:

_Display
_Design
_Events

ie.

Form1_Display
Form1_Design
Form1_Events

Now let's go back and add a few controls to our form and regenerate the entire program.

Click on the floating toolbars second to last button (looks like a form icon) to return to the Designer. Open your form again. Now add just a few controls (stick to simple ones first, like Buttons, CheckBoxes, Option Buttons, Frames).

You can double click the controls in the Designer to display their properties dialog. You can define properties, fonts, colors, text, etc.

Now generate the code by using the "Build Multi-Form App" option from the menu. Follow the directions above. Once generated paste the code into the PB IDE (a new file).

Save the source code file and compile it. You can run it to see how the form looks.

At this point now, examine the _Design and _Events routine for the specific Form to see how the code looks. The Designer will add the control ID's to the select case structure of the events routine. It will also generate a unique sub for each event selected in the Designers Controls Property Dialog.

You can add your own code (using the EZGUI command set) in these events.

It is very important to get a feel for the structure of an EZGUI application. By sticking to a simple form with just a few controls you can get a better understanding of how a program will look.

Next go back and add a menu to the form (just check the "Display Menu Below:" option in the Forms Property Dialog (double click form to display it). A menu was already defined by the designer when creating a new form, so we just have to tell the designer to use it.

Regenerate the application and examine how the menu code looks.

You can add other controls and keep regenerating the code to see how the app changes.

As stated before (this is only a practice session), you really need to have you forms fully designed before you generate your application. Adding new controls or forms to an application, after it has been generated once (can be done) is not so easy. It requires generating only portions of your code and more steps in copy and paste using the clipboard.


All times are EST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | Computer Workshop ( EZGUI ) Home Page

Copyright 2000 to 2007 Christopher R. Boss

Powered by: Ultimate Bulletin Board, Version 5.44
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.