Difference between revisions of "Mac Preferences and About Menu"

From Free Pascal wiki
Jump to navigationJump to search
(Platform template added.)
(Platform template updated.)
Line 1: Line 1:
{{Platform only|Mac OS X}}
+
{{Platform only|Mac OS X|Mac OS X|Mac OS X}}
 
These items should appear on the default menu that is titled with an applications' name.
 
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
 
The problem is that Lazarus doesn't currently provide direct access to this auto-generated

Revision as of 23:10, 5 January 2015

Stock-dialog-warning.svg

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:

MenuItems3.jpg


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

MenuItems.jpg


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

MenuItems2.jpg


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

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

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.

MenuItems4.jpg

See also