This is not so easy because the tab is usually intercepted by the control's
parent before it reaches the control.  As a result, the control never sees
the tab - ergo, there's no message to trap and all the control ever knows is
that it lost focus.

One way to achieve this is to intercept the CMDialogKey message in the
parent and compare Message.CharCode to VK_TAB.  You can base your code off
that in TCustomForm.CMDialogKey in the Forms unit, which also handles
shift-tab.  Then if you don't call inherited then you won't exit the control
at all (set Result to 1 to avoid a beep in this case).

Cheers,
Carl

-----Original Message-----
From: Edwin Das [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 19 July 2000 3:36 PM
To: Multiple recipients of list delphi
Subject: [DUG]: Trapping pressing of TAB Key


Hi

I am wondering if anybody knows a way of finding out
when the TAB key has been pressed inside a control (Editbox / Combobobox )

I can sort of get around it by using the onexit event but it would be nice
to know if they exited by pressing tab or some other means?

Any help is appreciated...  Thank you

------------------------------------------------
Edwin G. Das
Developer

exo-net international limited
email :  [EMAIL PROTECTED]
------------------------------------------------

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to