Mac Preferences and About Menu

From Free Pascal wiki
Jump to: navigation, search
Logo OSX.png

This article applies to Mac OS X only.

See also: Multiplatform Programming Guide

These items should appear on the default menu that is titled with an applications' name. The problem is that Lazarus doesn't currently provide direct access to this auto-generated menu, nor does it add these two items to it automatically. To get them on the same menu as Quit, you have to perform a little trick.

Create a menu item and name it your apps name, just for reference. Then, under that menu add the following:


Assign the "Preferences..." Menu Item Shortcut "Command ," using the "Grab key" button.


After you've pressed the "Command ," using "Grab key", this is how your shortcut will appear:


Then, to get these items on the MyApp menu, we must name the first menu item as follows:

    procedure TForm1.FormCreate(Sender: TObject);
         MenuItem1.Caption := #$EF#$A3#$BF;  //Unicode Apple logo char

Once your program is compiled and ran, you will notice that "About MyApp" and "Preferences..." have been added to the MyApp menu, which is where they should be.


See also