Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi TAction.ShortCut在动态创建的TAction中不工作_Delphi_Ribbon_Shortcut_Delphi Xe5 - Fatal编程技术网

Delphi TAction.ShortCut在动态创建的TAction中不工作

Delphi TAction.ShortCut在动态创建的TAction中不工作,delphi,ribbon,shortcut,delphi-xe5,Delphi,Ribbon,Shortcut,Delphi Xe5,在DelphiXe5中:我的表单上有一个战术管理器(称为ActionManager)和一个TRibbon(称为Ribbon)。我正在添加如下自定义操作: ActionBar := ActionManager.ActionBars.Add; newAction := TAction.Create(MainForm.ActionManager); newAction.Name := 'Topics'; newAction.Caption := 'Topics'; newAction.OnExecut

在DelphiXe5中:我的表单上有一个战术管理器(称为ActionManager)和一个TRibbon(称为Ribbon)。我正在添加如下自定义操作:

ActionBar := ActionManager.ActionBars.Add;
newAction := TAction.Create(MainForm.ActionManager);
newAction.Name := 'Topics';
newAction.Caption := 'Topics';
newAction.OnExecute := MainForm.HelpTopicsItemClick;
newMenu := ActionBar.Items.Add;
newMenu.Action := newAction;
newAction.ShortCut := TextToShortCut('F1');
在此之后,我将它们放置在页面/选项卡和组中的功能区上:

rp := TRibbonPage.Create(ActionManager);
rp.Parent := Ribbon;
Ribbon.AddTab(rp).Caption := 'Help';
rg := TRibbonGroup.Create(ActionManager);
rg.Parent := rp;
rg.ActionManager := ActionManager;
rg.Caption := 'Help';
rg.ActionClient := ActionBar;
当我单击该操作时,它工作正常,但是当我按“F1”时,什么也没有发生。当我使用Delphi编辑器手动添加操作时,快捷方式工作正常

我已尝试:newMenu.ShortCut:=newAction.ShortCut


这没用。我缺少什么?

当您创建新操作时,其ActionList属性不会自动设置为您随create一起提供的所有者。您必须明确设置操作列表才能使其正常工作

newAction := TAction.Create(MainForm.ActionManager);
newAction.ActionList := MainForm.ActionManager;
newAction.Name := 'Topics';

我想F1是用来帮忙的。尝试使用其他快捷方式。Is也不适用于其他快捷方式,如TextToSortcut('CTRL+H')Is
ActionManager
MainForm。ActionManager
相同?是的。很抱歉,这起作用了!但是,快捷方式仍然没有显示在ActionClient的标题中。有什么想法吗?或者这就是缎带的用意?