Recent

Author Topic: How to remove Start Dictation  (Read 5484 times)

bernie61

  • New Member
  • *
  • Posts: 15
How to remove Start Dictation
« 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

jwdietrich

  • Hero Member
  • *****
  • Posts: 1032
    • formatio reticularis
Re: How to remove Start Dictation
« Reply #1 on: December 24, 2015, 01:15:35 pm »
Which versions of Mac OS X, Lazarus and FPC do you use?
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.2 | FPC 3.0.4 | PPC, Intel, ARM | macOS, Windows, Linux

bernie61

  • New Member
  • *
  • Posts: 15
Re: How to remove Start Dictation
« Reply #2 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

jwdietrich

  • Hero Member
  • *****
  • Posts: 1032
    • formatio reticularis
Re: How to remove Start Dictation
« Reply #3 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.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.2 | FPC 3.0.4 | PPC, Intel, ARM | macOS, Windows, Linux

bernie61

  • New Member
  • *
  • Posts: 15
Re: How to remove Start Dictation
« Reply #4 on: January 01, 2016, 12:07:22 pm »
Thank you, your tip fixed the problem.