With default Windows settings, accelerator keys are not meant to be shown on dialogs until the user presses the ALT key.
Delphi's TLabel
control does not obey this convention, as shown below:
Although both label and check box have an accelerator key specified, the check box correctly hides it, but the label does not. Of course, when ALT is pressed, the accelerator shows for the check box, but it's the behaviour prior to that which is incorrect.
My understanding of why this happens is that the VCL code that implements this behaviour is contained in TWinControl
, for example the UpdateUIState
method, and relies on sending the underlying windowed control a WM_CHANGEUISTATE
message. Since TLabel
is not windowed, it misses out on this handling.
Can anybody suggest a way to achieve the desired behaviour for non-windowed controls?
Update 1
I've just discovered that group boxes and radio groups don't respond to UI state either.
Update 2