Author
|
Topic: Feedback about new code generator needed !
|
Chris Boss Administrator
|
posted 02-15-2005 04:24 PM
I am reworking the Visual Designer for EZGUI 3.5 and I need some feedback about changes I plan to make in the designer.I am working on the ability to add code directly within the Designer for events. The designer will simply run whatever IDE you are using where you modify the code and when you exit the IDE, the code is returned back to the designer and then embeded within the fmz file for each control. Since this will give you the ability to easily modify apps without much of the current hassles, it will be a big improvement. The problem is that to make this possible, I must change some of the style of coding generated by the designer and I must enforce certain rules about coding styles. Here is what I have in mind. This is an example of the new coding style that would be used: code:
#COMPILE EXE #DIM ALL ' -------------------- #INCLUDE "ezgui30.inc" ' -------------------- %EZ_Load = 25 ' ************************************************************************************* ' Application Constants and Declares ' ************************************************************************************* DECLARE SUB Form1_Display(BYVAL Parent$) DECLARE SUB Form1_Design() DECLARE SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&) ' ---------------------------------------------------------- %FORM1_FILE = 4000 ' ---------------------------------------------------------- %FORM1_NEWFILE = 4005 %FORM1_OPENFILE = 4010 %FORM1_SAVEFILE = 4015 %FORM1_SAVEAS = 4020 %FORM1_SEPARATOR_4025 = 4025 %FORM1_EXIT = 4030 %FORM1_BUTTON1 = 100 %FORM1_LISTBOX1 = 105 %FORM1_COMBOBOX1 = 110 %FORM1_LISTVIEW1 = 115 ' ------------------------------------------------ DECLARE SUB FORM1(BYVAL CID&, BYVAL CMsg&, BYVAL CVal&, Cancel&) DECLARE SUB FORM1_BUTTON1(BYVAL Msg&, BYVAL CVal&, Cancel&) DECLARE SUB FORM1_LISTBOX1(BYVAL Msg&, BYVAL CVal&, Cancel&) DECLARE SUB FORM1_COMBOBOX1(BYVAL Msg&, BYVAL CVal&, Cancel&) DECLARE SUB FORM1_LISTVIEW1(BYVAL Msg&, BYVAL CVal&, Cancel&) ' ************************************************************************************* ' Application Global Variables and Types ' ************************************************************************************* ' Global Handles for menus GLOBAL FORM1_hMenu0& GLOBAL FORM1_hMenu1&' Note: Do NOT change the names of the EZGUI Callback Procedures ! ' -------------------- #INCLUDE "ezwmain.inc" ' EZGUI Include file for WinMain ' -------------------- ' ************************************************************************************* ' EZGUI Program Control Functions ' ************************************************************************************* ' SUB EZ_Main(VerNum&) EZ_DefFont 6, "Arial", 10, "V" EZ_DefFont 7, "Courier New", 10, "F" EZ_DefFont 8, "Times New Roman", 10, "V" EZ_DefFont 9, "Arial Black", 36, "BV" 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 ' ' ------------------------------------------------------------------------------------- ' SUB Form1_Display(BYVAL Parent$) FORM1_hMenu0&=EZ_DefMainMenu( %FORM1_FILE, "&File", "") EZ_Color -1, -1 EZ_Form "FORM1", Parent$, "Your Dialog", 0, 0, 50, 18, "CK" END SUB ' ------------------------------------------------ ' GLOBAL Form1_FF& ' SUB Form1_Design() LOCAL FF&, X& '--------------------------------------------------------------- FF& = 9 ' - Offset for Font Numbers Form1_FF& = FF& ' Global for ODButtons Draw code '--------------------------------------------------------------- FORM1_hMenu1&=EZ_DefSubMenu( %FORM1_NEWFILE, "&New File", "") EZ_SetSubMenu FORM1_hMenu0& , %FORM1_FILE, FORM1_hMenu1& EZ_AddMenuItem FORM1_hMenu1&, %FORM1_OPENFILE, 0, "&Open File", "" EZ_AddMenuItem FORM1_hMenu1&, %FORM1_SAVEFILE, 0, "&Save File", "" EZ_AddMenuItem FORM1_hMenu1&, %FORM1_SAVEAS, 0, "Save File &As", "" EZ_AddMenuItem FORM1_hMenu1&, %FORM1_SEPARATOR_4025, 0, "-", "" EZ_AddMenuItem FORM1_hMenu1&, %FORM1_EXIT, 0, "E&xit", "" ' ------------------------------------------------ EZ_Color 0, 17 EZ_DefFont FF&+1, "MS Sans Serif", 8, "V" EZ_UseFont FF&+1 EZ_ODButton %FORM1_BUTTON1, 3, 1, 13, 3, "Button 1", "T" ' -------------------------------------------------------------- EZ_Color -1,-1 EZ_UseFont FF&+1 EZ_ListBox %FORM1_LISTBOX1, 22, 1, 19, 8, "Item 1|Item 2|Item 3|Item 4|Item 5|Item 6|Item 7|Item 8|Item 9|", "SAVTJ" FORM1_LISTBOX1 %EZ_Load, 0,X& ' -------------------------------------------------------------- EZ_UseFont FF&+1 EZ_ComboBox %FORM1_COMBOBOX1, 3, 5, 17, 5.25, "Item 1|Item 2|Item 3|Item 4|Item 5|", "SAVTJ" FORM1_COMBOBOX1 %EZ_Load, 0,X& ' -------------------------------------------------------------- EZ_UseFont FF&+1 EZ_ListView %FORM1_LISTVIEW1, 3, 10, 38, 6, "Column 1{15}|Column 2{15}{C}|Column 3{15}{R}|", "SVT-#" FORM1_LISTVIEW1 %EZ_Load, 0,X& ' -------------------------------------------------------------- END SUB ' ' ------------------------------------------------ ' SUB Form1_Events(CID&, CMsg&, CVal&, Cancel&) SELECT CASE CID& CASE %FORM1_BUTTON1 FORM1_BUTTON1 CMsg&, CVal&, Cancel& CASE %FORM1_LISTBOX1 FORM1_LISTBOX1 CMsg&, CVal&, Cancel& CASE %FORM1_COMBOBOX1 FORM1_COMBOBOX1 CMsg&, CVal&, Cancel& CASE %FORM1_LISTVIEW1 FORM1_LISTVIEW1 CMsg&, CVal&, Cancel& CASE ELSE FORM1 CID&, CMsg&, CVal&, Cancel& END SELECT END SUB ' ' <<<FORM1>>> ' '<FIXED> ------------------------------------------------------ SUB FORM1(BYVAL CID&, BYVAL CMsg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE CID& CASE %EZ_Window IF CMsg&=%EZ_Close THEN END IF CASE %FORM1_FILE IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_NEWFILE IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_OPENFILE IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_SAVEFILE IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_SAVEAS IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_SEPARATOR_4025 IF CMsg&=%EZ_Click THEN END IF CASE %FORM1_EXIT IF CMsg&=%EZ_Click THEN END IF END SELECT '<FIXED> ------------------------------------------------------ END SUB '<FIXED> ------------------------------------------------------ ' ' <<<FORM1_BUTTON1>>> ' '<FIXED> ------------------------------------------------------ SUB FORM1_BUTTON1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Click CASE %EZ_OwnerDraw EZ_Draw3DButton "Form1", %FORM1_BUTTON1, CVal&, 17, 0, Form1_FF& + 1 CASE ELSE END SELECT '<FIXED> ------------------------------------------------------ END SUB '<FIXED> ------------------------------------------------------ ' ' <<<FORM1_LISTBOX1>>> ' '<FIXED> ------------------------------------------------------ SUB FORM1_LISTBOX1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Load CASE %EZ_Change CASE ELSE END SELECT END SUB ' ' <<<FORM1_COMBOBOX1>>> ' '<FIXED> ------------------------------------------------------ SUB FORM1_COMBOBOX1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Load EZ_SelectItem "Form1", %FORM1_COMBOBOX1, 0 CASE %EZ_Change CASE ELSE END SELECT END SUB ' ' <<<FORM1_LISTVIEW1>>> ' SUB AnyRoutineIWantToUse() LOCAL R&, C&, Tmp$ FOR R&=0 TO 50 ' Rows FOR C&=0 TO 5 ' Columns Tmp$="Item "+RIGHT$("00"+LTRIM$(STR$(R&)),2)+","+STR$(C&) EZ_AddLVItem "Form1", %FORM1_LISTVIEW1, Tmp$, 0, R&, C&, "" NEXT C& NEXT R& END SUB ' ' the following is a required sub ' '<FIXED> ------------------------------------------------------ SUB FORM1_LISTVIEW1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Load AnyRoutineIWantToUse CASE %EZ_Change CASE %EZ_Selected CASE ELSE END SELECT '<FIXED> ------------------------------------------------------ END SUB '<FIXED> ------------------------------------------------------
The concept is only One SUB per Control (or Form). This would allow me to add the ability to Edit code from within the Designer. The Designer would simply run your favorite IDE and pass it the code for the current Control (or Form) where you would edit it and then when you exit the IDE, the Designer would embed that code within the FMZ file. This would allow you to be able to build multi-Form apps much easier. |
Chris Boss Administrator
|
posted 02-15-2005 04:28 PM
Some of the syntax rules that I would have to enforce (if you want code editing from Designer) is:(1) Constants would always have to be used. (2) Constants would always be FORM_CONTROL format. |
Gary Stout Member
|
posted 02-15-2005 04:48 PM
Chris,I don't see any problem at all with the changes that you proposing. For the time that this would save, I think the rule enforcement would be the least of our worries. I think it sounds like a great idea! Before you finish up 3.5, please allow the user to check which items in the code generation process they want so that we don't have to uncheck everything we don't want. I personally would prefer to have all unchecked so I can check only the ones needed. Thanks, Gary Stout
|
Chris Boss Administrator
|
posted 02-15-2005 05:04 PM
Gary,The 3.5 Designer will have two new buttons on the Code Generation Dialog: (1) Save Settings (2) Load Settings You will be able to save the settings and reload them back to make it easier to set them.
|
Robert E. DeBolt Member
|
posted 02-15-2005 05:27 PM
Chris,Will EZGUI3.0 fmz programs be upward compatible to 3.5? I realize that I will have to merge parts of my source code to the new subs, but I am used to that by now. ------------------ Regards, Bob |
Eddy Van Esch Member
|
posted 02-15-2005 05:30 PM
Chris,I don't see any problems with it. In the example, the SUB AnyRoutineIWantToUse, is that stored and edited from within the Designer or must that be added afterwards? Kind regards Eddy ------------------ Eddy raimundo4u at yahoo dot com
www.devotechs.com -- HIME Huge Integer Math and Encryption library [This message has been edited by Eddy Van Esch (edited 02-15-2005).] |
Chris Boss Administrator
|
posted 02-15-2005 06:44 PM
Robert,Yes the EZGUI 3.5 Designer will be able to read the 3.0 FMZ files. The 3.0 Designer though will not be able to read 3.5 files that have added code though. Eddy, The idea is when you click on the "Edit Code" button in the Listviews properties dialog, you would see only this: code:
' <<<FORM1_LISTVIEW1>>> ' SUB AnyRoutineIWantToUse() LOCAL R&, C&, Tmp$ FOR R&=0 TO 50 ' Rows FOR C&=0 TO 5 ' Columns Tmp$="Item "+RIGHT$("00"+LTRIM$(STR$(R&)),2)+","+STR$(C&) EZ_AddLVItem "Form1", %FORM1_LISTVIEW1, Tmp$, 0, R&, C&, "" NEXT C& NEXT R& END SUB ' ' the following is a required sub ' '<FIXED> ------------------------------------------------------ SUB FORM1_LISTVIEW1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Load AnyRoutineIWantToUse CASE %EZ_Change CASE %EZ_Selected CASE ELSE END SELECT '<FIXED> ------------------------------------------------------ END SUB '<FIXED> ------------------------------------------------------
The code between the lines: '<FIXED> ------------------------------------------------------ Should not be modified ! The designer will try to enforce this. All the rest of the code, including other subs, can be added as needed. |
Russ Srole Member
|
posted 02-15-2005 11:27 PM
Chris,Am I correct in assuming that "Form1" is a place holder & I can name each form anything I want? My programs tend to have a lot of forms & the only way I can keep things straight is to give them descriptive names. Russ |
Davide Vecchi Member
|
posted 02-16-2005 09:49 AM
Chris, i won't have any problems with the changes. I like them very much.------------------
|
Frank Kelley Member
|
posted 02-16-2005 12:05 PM
I use EZGUI extensively along with the JellyFish/Lynx combo for code creation. How well would your approach for 3.5 work with these third-party tools?Also, would the new coding style be an option when doing a multi-form app, or will the new coding style be uniform throughout any EZGUI-generated application (including single form apps)? Currently, I generate the code for my main form and then break the code for any secondary forms into logical sections and use them as include files in the main form code. The sections are: Declares Design Events With JellyFish, this allows me to open just those sections of code where I am working and I don't have to scroll through hundreds of lines to get where I need to be. It also allows me to quickly switch between sections to compare and modify code as needed (adding declares, constants, etc.). Would 3.5 prevent me from using this technique? I applaud your efforts to improve EZGUI. IMHO one of EZGUI's great strengths has been that after the form is designed and the skeleton code produced, EZGUI gets out of the way and lets you code the way you want. It makes me a little nervous to think that advantage might be reduced, even slightly. My 1/50th of a dollar. |
Eddy Van Esch Member
|
posted 02-16-2005 03:11 PM
Frank, I use the same tools as you do. One possible way to do things with Chris' new designer could be like this: In the designer you enter calls to your subs to respond to control events. For example like this: code:
'<FIXED> ------------------------------------------------------ SUB FORM1_LISTVIEW1(BYVAL Msg&, BYVAL CVal&, Cancel&) '<FIXED> ------------------------------------------------------ SELECT CASE Msg& CASE %EZ_Load MySub_ListViewLoad CASE %EZ_Change MySub_ListViewChanges CASE %EZ_Selected MySub_ListViewSelected CASE ELSE END SELECT '<FIXED> ------------------------------------------------------ END SUB '<FIXED> ------------------------------------------------------
Your subs: - MySub_ListViewLoad - MySub_ListViewChanges - MySub_ListViewSelected could reside and be maintained in a separate include file. Kind regards
------------------ Eddy raimundo4u at yahoo dot com www.devotechs.com -- HIME Huge Integer Math and Encryption library |
Roger Rines Member
|
posted 02-16-2005 03:33 PM
I'm of the same mind as Frank and will be concerned if we are forced into a process that is similar to what PB Forms imposes on its users.Like Frank, I like to break my code sections down into the three he mentions, plus I have an Include file listings for managing previously built modules. Much of what I use for code in my work was created for other projects, and when I need a set of file routines, I just add that code set to my Include File list and then stuff the Call routines into the SUBS that EZGUI creates for its events. For the times when I need to change a form, I almost always generate the code again, but never use the second generation of the code in its entirety. Instead I like to copy and paste the changes as needed into one of the three sections Frank mentioned above. Working with JellyFish Pro and Lynx as an IDE environment, plus the approach listed above keeps the original code work stabile and doesn't force me into needing to do more code generations than necessary to handle control positioning. It is also a very productive environment because of all the features that JFP & Lynx bring together. If the code generation from the new designer won't allow us to tinker anywhere in the code process, I sure hope it will allow us to just generate screen layout code, Constants, and events sections as we need them so we aren't forced to create a first pass code process so we can develop the code modules we might want the event SUBS to call, and then go back to the designer where we then paste those calls so they are included in a second pass. This is important because a lot of what is done in the event Subs isn't known at the time of the layout process. Often times we discover what we need by building the process that then teaches us what we didn't know we needed at the beginning. Maybe if we built everything in a process like Visual InterDev, or some other process layout tool, we wouldn't care where we needed to enter code. For me, I'm not smart enough at the beginning of a project to know everything I need, so flexibility in how I get there is really important. For certain I can see that we can ignore anything in a text file as being off limits, but as long as that doesn't prevent us from tweaking the layout when we discover what we didn't know the first time, then I don't see any draw backs. Give EZGUI users as much flexibility in how the code is generated so those of us who are comfortable with what we have now won't be forced to change our development process methods. From a designer perspective, I'm sure looking forward to seeing a smoother layout process where we have tools for managing the layout better. I'm also looking forward to using the new features you've been mentioning that are being added to the EZGUI DLL modules. Thanks for keeping the development moving. ------------------ Roger... mail to rdrines at spamcop dot net |
Chris Boss Administrator
|
posted 02-16-2005 05:25 PM
What I would like to do, is maintain the current Designer features (code generation) while offering an alternate code generation style which allows editing code from within the Designer (by running your favorite IDE directly from the designer).I don't like to break what works, so backward compatibility is important.
|
Frank Kelley Member
|
posted 02-16-2005 05:39 PM
In that case, you have my full, unequivocal support and encouragement!!! |
Michael Meeks unregistered
|
posted 02-24-2005 03:39 AM
Chris, I can concure and can agree with your last comments. Once EZGUI3.x - creates the source-code - I'm on another level all together with JellyFish/Lynx - (like Frank) - and although it's probably more work - it keeps my soure code files insync! Lastly - I need a couple of EZ_Commands added: Result& = EZ_TakeABrake("FORM1", %ezNow) Result& = EZ_TalkToTheWife("FORM", %ezWhenShesAround) We sometimes get lost in our programming for hours - and forget what's around us! Take those breaks - guys! Make sure your girl-friend, wives or whatever - is noticed and that you haven't fallen off the deep end. Cheers Mike | |