1) Ability to specify font properties.
2) Ability to specify default values for gadget properties similar to how we can set the preferences for Purebasic.
3) The ability to use modules as shown below. Modules would allow the same standard names to be used for procedures of each window and hide the implementation. The creation of Pre and Post procedures allows the customization of the form in code without affecting the designer produced code.
4) The ability to specify the name of the default include file if not specified it just defaults to the form name with a ".pb" extension as seen below.
5) A new preference in Purebasic so that the users who do not wish to use the module approach can have the code generated as it does now.
Thanks,
Simon
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
UseJPEGImageDecoder()
DeclareModule frmKPLogin
Global imgSplash, lblUser, lblPwd, txtUser, txtPwd, cmdLogin, cmdLogoff, cmdChange
Declare OpenForm()
Declare Events(event)
EndDeclareModule
Module frmKPLogin
Procedure OpenForm_Exec(x = 0, y = 0, width = 600, height = 400)
Image1 = LoadImage(#PB_Any,"C:\Business\dCipherComputing\Applications\KardPoll\VFP9\dcMain.JPG")
frmKPLogin = OpenWindow(#PB_Any, x, y, width, height, "Login", #PB_Window_SystemMenu)
imgSplash = ImageGadget(#PB_Any, 0, 0, 100, 400, ImageID(Image1))
lblUser = TextGadget(#PB_Any, 230, 125, 50, 25, "User")
lblPwd = TextGadget(#PB_Any, 230, 165, 50, 25, "Password")
txtUser = StringGadget(#PB_Any, 300, 120, 90, 24, "User")
txtPwd = StringGadget(#PB_Any, 300, 160, 90, 24, "Password")
cmdLogin = ButtonGadget(#PB_Any, 270, 210, 130, 30, "Login")
cmdLogoff = ButtonGadget(#PB_Any, 110, 250, 130, 30, "Logoff and Exit")
cmdChange = ButtonGadget(#PB_Any, 320, 250, 130, 30, "Change Password")
EndProcedure
XIncludeFile "frmKPLogin.pb" ;This is where OpenForm_Pre, OpenForm_Post or any other procedures would be defined.
Procedure OpenForm()
If OpenForm_Pre()
OpenForm_Exec()
EndIf
ProcedureReturn OpenForm_Post()
EndProcedure
Procedure Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
EndModule
frmKPLogin::OpenForm()
Repeat
event = WaitWindowEvent()
Until frmKPLogin::Events(event) = #False
End
Code: Select all
Procedure OpenForm_Pre()
If LoadFont(0,"Tahoma",9,#PB_Font_Bold)
SetGadgetFont(#PB_Default,FontID(0))
EndIf
ProcedureReturn 1
EndProcedure
Procedure OpenForm_Post()
SetGadgetText(txtPwd,"dCipher")
ProcedureReturn 1
EndProcedure