Application Menu
Application Menu
About and settings menus seem to be greyed out, does anyone know how to enable them?
Re: Application Menu
Code: Select all
Global mainWindow
Enumeration MenuItems
#menuItem1
#menuItem2
EndEnumeration
Procedure main()
mainWindow = OpenWindow(#PB_Any, 0, 0, 450, 160, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateMenu(0, WindowID(mainWindow)) ;-Menüs...
MenuItem(#PB_Menu_About, "About")
MenuItem(#PB_Menu_Preferences, "Preferences")
MenuTitle("myMenu")
MenuItem(#menuItem1, "Open" +#TAB$+"Cmd+O")
MenuItem(#menuItem2, "Save" +#TAB$+"Cmd+S")
EndIf
EndProcedure
Procedure windowEvents(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #PB_Menu_About
Debug "About"
Case #PB_Menu_Preferences
Debug "Preferences"
Case #menuItem1
Debug "Open"
Case #menuItem2
Debug "Save"
Case #PB_Menu_Quit
ProcedureReturn #False
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
main()
Repeat
event = WaitWindowEvent()
Until windowEvents(event) = #False
macOS Catalina 10.15.7
Re: Application Menu
Thanks I got it working
Re: Application Menu
I have a problem with the Quit event. It is always available even when a requester is active. When you click on quit it has to wait until the requester has been closed. Is there any way to close the requester using the quit menu?
- Mindphazer
- Enthusiast
- Posts: 460
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: Application Menu
Can you post your code ?
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: Application Menu
I found a solution:
Quit needs to be a global I think.
Code: Select all
Procedure CallbackQuit()
CloseWindow(#PB_All)
Quit = 1
EndProcedure
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
BindMenuEvent(0, #PB_Menu_Quit, @CallbackQuit())
CompilerEndIf
Re: Application Menu
Is there a way to change the application menu for example when a file requester is opened all the menu items in the application menu are greyed out including quit? This is how other applications do it like Firefox.