Firemonkey accelerator key

121 views Asked by At

I'm looking for a way to register the accelerator key other than the standard way, that is when the text with the accelerator key is set to the tLabel.

I googled a lot and did not find nothing of the sort.

Also, in other question, was suggested to set the Label's Text property at Form's creation, after setting the Label's parent, but this does not work because the Label's Text and Parent properties, might be set dynamically at run time.

Assuming the form has a TEdit, a TLabel and a TRectangle, named respectively MyEdit, MyLabel and MyRect, follows a brief code example

...
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;      
0

There are 0 answers