Author: Jonas Bilinkevicius
I have a tab control with a tab called "Polic&y Info" with the ALT-Y key set to
switch to it. If I am on a TCheckBox on any tab and press only the "Y" key, the tab
control switches pages.
Answer:
This is nothing specific to a checkbox, it is standard Windows behaviour. If the
control having focus does not process character input then ALT is not needed to
have a character act as an accelerator. To fix this, add a handler for
CM_DIALOGCHAR to your form:
1 private2 { Private declarations }3 4 procedure cmDialogChar(var msg: TCMDialogChar); message CM_DIALOGCHAR;
5 6 procedure TForm1.cmDialogChar(var msg: TCMDialogChar);
7 begin8 if ((msg.keydata and $20000000) = 0) then9 msg.result := 1 { ALT not down, eat key }10 else11 inherited;
12 end;