Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firemonkey - catching Alt key + character with FromKeyDown

Raphahz

Programmer
Nov 21, 2024
1
I want to capture the sequence of key combination Alt + Character,
where "Character" can be any valid character key from the keyboard, like 'A', 'B', etc.

So far I have this code:


Code:
procedure Tform1.FormKeyDown (Sender: tObject; var Key: Word; var KeyChar: Char; Shift: tShiftState);
     begin
         if ssAlt in Shift then begin
            IsKeyAltDown := True;
            Key := 0;
         end;
         if KeyAltDown then begin
            IsKeyAltDown := False;
             if KeyChar = 'c' then
                DoSomething;       
         end;
     end;

The first 'if' succeeds on detecting Alt key but the second 'if' does not succeed.

Any help will be appreciated.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top