second window
Posted: Mon Oct 21, 2024 8:34 am
I’m trying to create a window with a button that, when clicked, should open a second window. However, every time I press the button, nothing happens, and no errors appear. Here's the code I’m working with:
Could anyone point out what I might be doing wrong here? The second window just doesn’t seem to open. Any help would be appreciated!
Code: Select all
If OpenWindow(0, 100, 100, 300, 200, "Main Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(1, 100, 70, 100, 30, "Open Second Window")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 1
; Trying to open second window here
If OpenWindow(1, 200, 150, 300, 200, "Second Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Else
MessageRequester("Error", "Failed to open the second window", 0)
EndIf
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf