Page 1 of 1

Proper Mac menu usage

Posted: Thu Oct 11, 2012 5:17 pm
by kenmo
I am essentially new to Macs, so I'm not sure how to use the main Mac menu properly (not even sure what it's called).

First, how do I change the name of the bolded menu title next to the Apple logo? When I run PB programs the title is "PureBasic.0" or similar. Is there a way to change this, or does it just change when I compile and properly name the .app?

Second, am I using the special menu constants correctly?

Code: Select all

Flags.i = #PB_Window_SystemMenu | #PB_Window_ScreenCentered

OpenWindow(0, 0, 0, 480, 360, "Menu Item Test", Flags)

CreateMenu(0, WindowID(0))
MenuItem(#PB_Menu_About, "About TEST")
MenuItem(#PB_Menu_Preferences, "About PREF")
MenuItem(#PB_Menu_Quit, "About QUIT")

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
On the default (Cocoa?) subsystem on OSX 10.5 and 10.7, none of these menu items show up named correctly in the "PureBasic.0" menu. (They show up "About PureBasic.0", "Quit PureBasic.0", and "Preferences..."). In the "carbon" subsystem, only the About entry shows up with the custom name.

Re: Proper Mac menu usage

Posted: Thu Oct 11, 2012 9:01 pm
by WilliamL
kenmo,

yup, it changes when you create the executable, it just looks odd in the IDE. I've been using the constants and it works ok but, I think, I had to use other constants (in place or along with these) when I used ToolBarButtons.

Re: Proper Mac menu usage

Posted: Wed Oct 23, 2013 2:57 pm
by mag
Related issue..

How do we know user click "Preferences..." and "About" menu there. I like to use it

Re: Proper Mac menu usage

Posted: Wed Oct 23, 2013 2:59 pm
by wilbert
mag wrote:Related issue..

How do we know user click "Preferences..." and "About" menu there. I like to use it
It's mentioned in the PB help file under Menu
There are predefined menu events #PB_Menu_Quit, #PB_Menu_About and #PB_Menu_Preferences to represent the entries in the application menu which is present on every OSX program. Their values are negative to not conflict with any menu entries defined in the program. They are reported from EventMenu() as regular menu events.