瀏覽代碼

Make it so you can call SetFakeShortCutText more than once on the same item.

Martijn Laan 1 年之前
父節點
當前提交
e8a0d69282
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Projects/Src/CompFunc.pas

+ 5 - 1
Projects/Src/CompFunc.pas

@@ -449,7 +449,11 @@ end;
 
 
 procedure SetFakeShortCutText(const MenuItem: TMenuItem; const S: String);
 procedure SetFakeShortCutText(const MenuItem: TMenuItem; const S: String);
 begin
 begin
-  MenuItem.Caption := MenuItem.Caption + #9 + S;
+  var Caption := MenuItem.Caption;
+  var P := Pos(#9, Caption);
+  if P <> 0 then
+    Delete(Caption, P, MaxInt);
+  MenuItem.Caption := Caption + #9 + S;
 end;
 end;
 
 
 procedure SetFakeShortCut(const MenuItem: TMenuItem; const Key: Word;
 procedure SetFakeShortCut(const MenuItem: TMenuItem; const Key: Word;