Difference between revisions of "Mac Preferences and About Menu"

From Free Pascal wiki
Jump to navigationJump to search
(Platform template updated.)
m (Added syntax highlighting wiki markup)
Line 23: Line 23:
 
Then, to get these items on the MyApp menu, we must name the first menu item as follows:
 
Then, to get these items on the MyApp menu, we must name the first menu item as follows:
  
 +
<syntaxhighlight lang="pascal">
 
     procedure TForm1.FormCreate(Sender: TObject);
 
     procedure TForm1.FormCreate(Sender: TObject);
 
     begin
 
     begin
 
           MenuItem1.Caption := #$EF#$A3#$BF;  //Unicode Apple logo char
 
           MenuItem1.Caption := #$EF#$A3#$BF;  //Unicode Apple logo char
 
     end;  
 
     end;  
 +
</syntaxhighlight>
  
 
Once your program is compiled and ran, you will notice that "About MyApp" and
 
Once your program is compiled and ran, you will notice that "About MyApp" and

Revision as of 04:28, 3 July 2019

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