张志峰的博客

水滴石川,积少成多。

导航

Delphi 设置快捷键

Posted on 2017-12-18 17:43  ╰★张志峰★╮  阅读(1320)  评论(0编辑  收藏  举报

= 'Repeat %s(&' + #32 + ')';  //设置快捷键  这个是设置空格的  如果设置字符,  就可以这样写= 'Repeat %s(&H)‘

 

 

const
SRepeatCmdCaption_TME = 'Repeat %s(&' + #32 + ')'; //设置快捷键
SRepeatHint_TME = 'Repeat %s';
var
sLastHint, sLastCaption: string;
begin
if not CheckCanExecute then Exit;
if FRepeatAction <> nil then
begin
acRepeatCmd.Visible := (FRepeatAction as TAction).Visible;
acRepeatCmd.Enabled := (FRepeatAction as TAction).Enabled;
acRepeatCmd.ShortCut := 32;
sLastHint := (FRepeatAction as TAction).Hint;
sLastCaption := (FRepeatAction as TAction).Caption;
sLastCaption := GetSubString(sLastCaption, '(', 1);
acRepeatCmd.Hint := Format(SRepeatHint_TME,[sLastHint]);
if sLastHint <> '' then
acRepeatCmd.Caption := Format(SRepeatCmdCaption_TME, [sLastHint])
else
acRepeatCmd.Caption := Format(SRepeatCmdCaption_TME, [sLastCaption]);
end;
end;