Creating a Application with multiple Forms is not "easy going" in PureBasic.
Not like in Firefly or in Phoenix, just drag and drop.
Instead you have to handcode the event-loop.
Here is an example for 2 Forms.
It can easily be customized for many more forms.
;---------------------------------------------
; Main
;---------------------------------------------
; OpenConsole() + PrintN("") -> very good for Debug-Printing
: Opens the Form and generates all the controls of the Main -Form
OpenFRM_Main()
; Set all the controls of Mainform to their default state
Main_Init()
; Here is the Main-Event-Loop
Repeat
; Get the Event
Event = WaitWindowEvent()
; Get the Windowhandle of the window for which the event was
Fes.l=EventWindow()
Select Fes
Case FRM_Main
; This Procedure is for the Events of the Main-Window-Form
FRM_Main_Events(event)
Case FRM_Set
; This Procedure ist for the Events of the Settings-Form
FRM_Set_Events(event)
EndSelect
; If the Settings-Form is closed, the Application should NOT END.
; If the Main-Form is closed the application should end. This happens here below.
If Event = #PB_Event_CloseWindow ; Beenden, wenn eines der Fenster geschlossen wird.
If Fes=FRM_Main
Break
Else
CloseWindow(Fes)
EndIf
EndIf
ForEver
; The "Break" from above comes here .... if the Main-Form is closed
CloseWindow(Fes)
End