accelerator key
標準的な方法以外の を登録する方法、つまり のテキストが にaccelerator key
設定されている場合を探していますtLabel
。
私はたくさんグーグルで検索しましたが、そのようなものは何も見つかりませんでした。
また、他の質問では、親を設定した後、作成Label's
時に Text プロパティを設定することが提案されましたが、実行時に Text プロパティと Parent プロパティが動的に設定される可能性があるため、これは機能しません。Form's
Label's
Label's
TEdit
フォームに a 、 a 、 aTLabel
がありTRectangle
、それぞれMyEdit
、 、MyLabel
およびという名前が付けられていると仮定するとMyRect
、簡単なコード例に従います。
...
interface
type
tMyForm = class (TForm)
...
procedure FormCreate (Sender: tObject);
...
end;
...
implementation
tMyForm.FormCreate (Sender: tObject);
begin
...
MyLabel.FocusControl := MyEdit;
MyLabel.Text := '&Label';
MyLabel.Parent := MyRect; // after this setting
// the accelerator key stop working
// I need some code here that makes the accelerator key work, no matter where
// I set the TLabel's Text and Parent properties
...
end;