after quite a long time i will do a restart with PureBasic.
I never used the integrated Form Designer and always coded my UI by hand.
Now i want to see, if the Form Designer can make my work easier.
i have these 2 files:
hello.pb:
MainWindow.pbf
This works:
hello.pb
Code: Select all
XIncludeFile "MainWindow.pbf"
OpenWindow_0()
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
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.
;
Global Window_0
Global Text_0, Button_0
Declare ResizeGadgetsWindow_0()
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "Main Window", #PB_Window_SystemMenu)
Text_0 = TextGadget(#PB_Any, 10, 10, 470, 25, "")
Button_0 = ButtonGadget(#PB_Any, 490, 10, 100, 25, "Klick mich!")
EndProcedure
Procedure ResizeGadgetsWindow_0()
Protected FormWindowWidth, FormWindowHeight
FormWindowWidth = WindowWidth(Window_0)
FormWindowHeight = WindowHeight(Window_0)
ResizeGadget(Text_0, 10, 10, FormWindowWidth - 130, 25)
ResizeGadget(Button_0, FormWindowWidth - 110, 10, 100, 25)
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_SizeWindow
ResizeGadgetsWindow_0()
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
[20:22:06] [COMPILER] Zeile 3: OpenMainWindow() ist keine Funktion, Array, Makro oder LinkedList.
What is this Window_0? Is it the Window-ID?
I thought when changing the Property "Variable" in the Form Designer from Window_0 to e.g. "MainWindow" and change the procedure call in the main code to
Code: Select all
OpenMainWindow()
Code: Select all
OpenWindow_0()
Any ideas whats wrong in my considerations?
Michael