#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    28
    Rep Power
    0

    Perform operation on TAB key press ?


    Is it possible to perform some operation on TAB key press event ?
    If it is, help me with sample code.

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Augsburg Germany
    Posts
    12
    Rep Power
    0
    procedure TForm1.AppOnMessageEv(var Msg: TMsg; var Handled: Boolean);
    var
    ShiftState: TShiftState;
    begin
    if Msg.message = WM_SYSKEYUP then
    begin
    if (Msg.WParam = VK_TAB) then
    begin
    // YOUR CODE
    end;
    end;
    end;
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    3
    You can handle the form's OnKeyPress event and handle only for #8 (ascii code of TAB character).
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    59
    Rep Power
    6
    A fair warning to the original poster - I have tried something like this in the past, and having any components on my form with their tabstop property set to true seemed to prevent the code from running. You might want to watch out for that.

IMN logo majestic logo threadwatch logo seochat tools logo