4otomax wrote: Tue Sep 21, 2021 10:42 am
Also I tried not to use #PB_Any for gadget id's. Form designer created enumerations for gadgets, but it's not possible to set start value for them. So there can be same situation: different gadgets takes equal id's, right?
The Form Designer uses a named enumeration for window numbers and gadget numbers. They should get continuous numbering automatically when the seperate form files are included in a "main" file - something like this:-
Code: Select all
; ** FIRST FORM FILE
;
; 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.
;
Enumeration FormWindow
#Window_0
EndEnumeration
Enumeration FormGadget
#Button_0
#Calendar_0
#Checkbox_0
EndEnumeration
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
ButtonGadget(#Button_0, 10, 10, 100, 25, "")
CalendarGadget(#Calendar_0, 10, 55, 265, 100, 0)
CheckBoxGadget(#Checkbox_0, 10, 170, 100, 25, "")
EndProcedure
Procedure Window_0_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
; ** SECOND FORM FILE
;
; 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.
;
Enumeration FormWindow
#Window_1
EndEnumeration
Enumeration FormGadget
#Combo_1
#Date_1
#Editor_1
EndEnumeration
Procedure OpenWindow_1(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#Window_1, x, y, width, height, "", #PB_Window_SystemMenu)
ComboBoxGadget(#Combo_1, 10, 10, 100, 25)
DateGadget(#Date_1, 10, 40, 100, 25, "")
EditorGadget(#Editor_1, 10, 75, 100, 25)
EndProcedure
Procedure Window_1_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
; ** "INCLUDING FILE"
; Ok I've squashed everything into one but hopefully you get the idea.
OpenWindow_0()
OpenWindow_1()
Debug "Windows"
Debug #Window_0
Debug #Window_1
Debug "Gadgets"
Debug #Button_0
Debug #Calendar_0
Debug #Checkbox_0
Debug #Combo_1
Debug #Date_1
Debug #Editor_1
Repeat
Event = WaitWindowEvent(50)
If Event = #PB_Event_CloseWindow
Quit = #True
EndIf
If EventWindow() = #Window_0
Window_0_Events(Event)
ElseIf EventWindow() = #Window_1
Window_1_Events(Event)
EndIf
Until Quit = #True
(Just for the record I'm NOT handling Window closures properly in this example.)