Proper Mac menu usage

Mac OSX specific forum
User avatar
kenmo
Addict
Addict
Posts: 2081
Joined: Tue Dec 23, 2003 3:54 am

Proper Mac menu usage

Post 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.
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Proper Mac menu usage

Post 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.
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Re: Proper Mac menu usage

Post by mag »

Related issue..

How do we know user click "Preferences..." and "About" menu there. I like to use it
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Proper Mac menu usage

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply