Question and Answer Database FAQ2032D.txt Keyboard shortcut to a component that has no caption Category :VCL Platform :All Product :All 32 bit Question: How can I create a keyboard shortcut to a component that has no caption? Answer: One work around is to leverage the FocusControl property of TLabel. The following example demonstrates using an invisible label control to create a keyboard shortcut to a memo control. The shortcut will respond to the Alt+M key combination. To use this example, place a label, a memo, and several other controls that receive focus. Run the application, move focus to a control other than "Memo1", and key in-M. You should see focus move to Memo1. Example: procedure TForm1.FormCreate(Sender: TObject); begin Label1.Visible := false; Label1.Caption := '&M'; Label1.FocusControl := Memo1; end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99