(It has nothing to do with hidden, it happens always if I there are multiple windows)
#PB_Menu_Quit (inside window 0) was not working anymore.
After some debugging I found out the the return value of EventWindow() is -1 in this case.
So I needed:
Code: Select all
OpenWindow(0, 0, 0, 10, 10, "", #PB_Window_Invisible)
OpenWindow(1, 0, 0, 300, 200, "Foreground", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Select EventWindow()
Case -1
Select EventMenu()
Case #PB_Menu_Quit
Debug "macOS menu quit"
Exit = #True
EndSelect
Case 0
Select Event
Case #PB_Event_CloseWindow
Exit = #True
EndSelect
Case 1
Select Event
Case #PB_Event_CloseWindow
PostEvent(#PB_Event_CloseWindow, 0, 0)
EndSelect
EndSelect
Until Exit
Is this the correct way
I have a program where it is working after case #MainWindow (where #MainWindow is 0) strange ...
Ok, one step further:
If I use CreateMenu() in window 0 the macOS menu event returns in window 0 and not -1
But without a program menu it is definately -1.