Lazarus

Programming => Widgetset => Carbon => Topic started by: bernie61 on December 10, 2015, 04:06:14 pm

Title: How to remove Start Dictation
Post by: bernie61 on December 10, 2015, 04:06:14 pm
Hi

OSX automatically adds "Start Dictation"  to the bottom of the Edit menu of my application.
Now my application edits images, so that menu command is of no use at all.

How to avoid that?
I tried renaming the menu (like they do in Qt, adding an space) but it did'n work.

Of course I use the carbon widgeset. I would like to use QT instead, but I don't know how.

Thanks in advance
bernie
Title: Re: How to remove Start Dictation
Post by: jwdietrich on December 24, 2015, 01:15:35 pm
Which versions of Mac OS X, Lazarus and FPC do you use?
Title: Re: How to remove Start Dictation
Post by: bernie61 on December 30, 2015, 05:52:52 pm
I use:
Lazarus 1.4.4
FPC 2.6.4
OS X Mavericks

Thanks in advance,
bernie
Title: Re: How to remove Start Dictation
Post by: jwdietrich on December 31, 2015, 04:25:23 pm
Newer versions of Mac OS X are a bit tricky here. The OS automatically adds the entry "Start Dictation", if the fourth menu (the second after the apple menu and the program menu) has an entry, whose name contains the substring "Copy" or "copy". Even renaming it to "Copy " doesn't solve the issue, since "Copy" is a substring of "Copy ".

The possibly simplest solution is to give the corresponding entry a caption that doesn't contain "Copy", e.g. "Cop" and rename it programmatically to "Copy". It wouldn't work to do this before Application.Run, since Mac OS X would add the unwanted entries anyway. Therefore, the best place to do this is in the onClick handler of the edit menu:

Code: Pascal  [Select][+][-]
  1. procedure TMainForm.EditMenuClick(Sender: TObject);
  2. begin
  3.   CopyItem.Caption := 'Copy';
  4. end;
  5.  

The attached zip archive contains a very simple example program that implements this technique.
Title: Re: How to remove Start Dictation
Post by: bernie61 on January 01, 2016, 12:07:22 pm
Thank you, your tip fixed the problem.
TinyPortal © 2005-2018