由于此线程中提供的帮助和建议,我使用 Microsoft 功能区框架创建了我的第一个非 Delphi 功能区。
按照A.Bouchez 在该线程中发布的指南,我设法编译了我的项目并查看了 Microsoft 功能区的运行情况。
但是,执行命令时,我似乎无法让功能区响应输入。
我总是使用 TActionManager 来管理我的事件,所以我需要的只是将每个 TAction 从 TActionManager 链接到功能区。按照上面链接的教程,我尝试了以下方法无济于事:
// actNew is the name of a TAction set in the TActionManager
procedure TfrmMain.actNewExecute(Sender: TObject);
begin
ShowMessage('execute new event');
end;
procedure TfrmMain.CommandCreated(const Sender: TUIRibbon; const Command: TUICommand);
begin
inherited;
case Command.CommandId of
cmdNew: // cmdNew was defined in the Ribbon Designer
begin
// link the ribbon commands to the TActions
actNew.OnExecute(Command as TUICommandAction); // obviously will not work
end;
end;
end;
那么,如何将我的 TActions 分配给功能区?
谢谢。