UBBFriend: Email This Page to Someone!
  Computer Workshop User Forums
  Beginners Startup Tutorials (Read Only)
  EZGUI 4.0 Pro Designer - Walk Through (part 4) (2 meg) (non-rect Form)

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

next newest topic | next oldest topic
Author Topic:   EZGUI 4.0 Pro Designer - Walk Through (part 4) (2 meg) (non-rect Form)
Chris Boss
Administrator
posted 03-27-2007 11:50 AM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Part 4:

This is an example of creating a project with a non-rectangular Form (using regions).

(1) Create a blank Form in your project

(2) Double click form to display Form properties dialog

(Select the "Shape To Picture" option)

(3) Display Bitmap open file dialog and select your bitmap

(The Bitmap requires the first pixel [0,0] to be considered the transparent color)

(4) Form is now non-rectangular. Run "Test" mode to see how it will look.

(5) Let's add a Button control

(6) Double click Button control to display Button properties dialog

(Select the "SetRegion (Rounded Rect)" option. Click BG color button and change BG color.)

(7) Button control is now 3D and uses a rounded rectangular region. Lets' generate the code

(8) Generate code.


(9) Compile and Run application.


Chris Boss
Administrator
posted 03-27-2007 12:07 PM     Click Here to See the Profile for Chris Boss     Edit/Delete Message Reply w/Quote
Here is the source code for this application.

The code I added manually was the messagebox code in the button controls %EZ_Click event and the EZ_UnloadForm command in the forms %EZ_RButtonUp event (so I can close the form).


All of the rest of the code is generated by the Visual Designer. Notice how little code is needed for this application!

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_BUTTON1 = 100
'
DECLARE SUB FORM1_BUTTON1_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)
LOCAL PN$
PN$=EZ_LoadPicture("formbg1.bmp")
EZ_ShapeFormToPicture PN$, -1
EZ_Color -1, -1
EZ_Form "FORM1", Parent$, "", 0, 0, 71.125, 29.75, "CZ"
EZ_FreeImage PN$
END SUB
'
SUB EZ_FORM1_Design() ' (PROTECTED)
LOCAL CText$
EZ_Color 0, 38
EZ_UseFont 0
EZ_ODButton %FORM1_BUTTON1, 9, 20, 26, 3, "Button 1", "T"
EZ_SetRegion "Form1", %FORM1_BUTTON1,-2,0
END SUB
'
SUB EZ_FORM1_ParseEvents(CID&, CMsg&, CVal&, Cancel&) ' (PROTECTED)
SELECT CASE CID&
CASE %EZ_Window
FORM1_Events CID&, CMsg&, CVal&, Cancel&
IF CMsg&=%EZ_LButtonDown THEN
EZ_DragForm "FORM1"
END IF
CASE %FORM1_BUTTON1
FORM1_BUTTON1_Events CID&, CMsg&, CVal&, Cancel&
IF CMsg&=%EZ_OwnerDraw THEN
EZ_Draw3DButtonRR "Form1", %FORM1_BUTTON1, CVal&, 38, 0, 0
END IF
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_RButtonUp
EZ_UnloadForm "Form1"
CASE %EZ_Close
CASE ELSE
END SELECT
CASE ELSE
END SELECT
END SUB
'
SUB FORM1_BUTTON1_Events( MyID&, CMsg&, CVal&, Cancel&)
SELECT CASE CMsg&
CASE %EZ_Click
MSGBOX "Say Hello There"
CASE ELSE
END SELECT
END SUB
'
'<<END ALL FORMS>> UnKnown Routines follow:
#IF %EZ_NOSKIPCODE
#ENDIF 'PARSE END
'



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.