I have a CRME of a Delphi application with the following menu (i've reproduced this in both Delphi XE6 and Delphi 7):
If you press N, it will run handler for N̲ew.
If you press O, it will run handler for O̲pen.
If you press P, it will the handler for Op̲en Recent.
If you press S, it will highlight
S̲ave, but it will not run it:
And if you press S again, it will highlight
Save & Minimiz̲e, but it will not run it:
And in order to try to diagnose the problem, i trimmed it down to only the menu items that start with S:
Why does it only flip between those two, and not include the middle one that also starts with S?
Why does it flip between them at all?
Why does pressing O not flip between:
Even removing the Ctrl+S
shortcut on S̲ave doesn't fix it:
And why does it skip the middle one?
What am i missing?
FMain.pas
unit FMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, ActnList;
type
TForm1 = class(TForm)
ActionList1: TActionList;
actSave: TAction;
actSaveAs: TAction;
actSaveAndMinimize: TAction;
MainMenu1: TMainMenu;
File1: TMenuItem;
Save1: TMenuItem;
SaveAs1: TMenuItem;
SaveMinimize1: TMenuItem;
procedure actSaveExecute(Sender: TObject);
procedure actSaveAsExecute(Sender: TObject);
procedure actSaveAndMinimizeExecute(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.actSaveExecute(Sender: TObject);
begin
ShowMessage('save');
end;
procedure TForm1.actSaveAsExecute(Sender: TObject);
begin
ShowMessage('saveas');
end;
procedure TForm1.actSaveAndMinimizeExecute(Sender: TObject);
begin
ShowMessage('save and minimize');
end;
end.
FMain.dfm
object Form1: TForm1
Left = 448
Top = 220
Width = 504
Height = 281
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ActionList1: TActionList
Left = 48
Top = 40
object actSave: TAction
Category = 'File'
Caption = '&Save'
OnExecute = actSaveExecute
end
object actSaveAs: TAction
Category = 'File'
Caption = 'Save &as'
OnExecute = actSaveAsExecute
end
object actSaveAndMinimize: TAction
Category = 'File'
Caption = '&Save && Minimi&ze'
OnExecute = actSaveAndMinimizeExecute
end
end
object MainMenu1: TMainMenu
Left = 16
Top = 40
object File1: TMenuItem
Caption = '&File'
object Save1: TMenuItem
Action = actSave
end
object SaveAs1: TMenuItem
Action = actSaveAs
end
object SaveMinimize1: TMenuItem
Action = actSaveAndMinimize
end
end
end
end
It's a trivial typo on your side.
The caption of actSaveAndMinimize
is &Save && Minimi&ze
which is invalid, since it has two accelerator characters. You clearly mean Save && Minimi&ze
.