|
Setup: I would like to assign an Alt-Letter key combination to a button. In Lazarus I would jus set the caption to include & (for example &Scan would have the S underlined and Alt-S would fire the button). I can't seem to find an equivalent in fpgui. &Scan shows &Scan. Thanks, |
Replies: 2 comments 3 replies
|
Hi Steve, You're right that this wasn't supported — I've just implemented it on the btnScan.Text := '&Scan'; { S is underlined, Alt+S fires the button }
chkVerbose.Text := '&Verbose'; { Alt+V toggles it }Use A few implementation notes that may matter to you:
Rather than special-casing buttons, this went in as an There's a runnable demo at This is on if (ShiftState * [ssShift, ssAlt, ssCtrl] = [ssAlt]) and (KeyCode = keyS) then
begin
btnScan.Click;
Consumed := True;
end;Would be great to hear how it works out on Wayland if you get a chance to try the |

Hi Steve,
You're right that this wasn't supported —
&was only ever handled in menu items, never in buttons, so&Scanwas painted literally. Good catch, and thanks for the clear report.I've just implemented it on the
developbranch. Buttons, checkboxes and radio buttons now support the same&convention you're used to from Lazarus:Use
&&when you want a literal ampersand in the text —'Black && &White'paints "Black & White" with the W underlined.A few implementation notes that may matter to you: