bdn.borland.com

Article #28798: How to catch a 'Tab Character' key stroke inside your TEdit control.

Question: How can I catch the tab character inside of my Edit controls?

Answer: This can easily be done by overriding the forms CMDialogKey procedure. To see how this works drop a Edit on the form and enter in the following code:

procedure TMyForm.CMDialogKey(Var Msg: TWMKEY);
begin
if (ActiveControl = Edit1) and (Msg.Charcode = VK_TAB) then
begin
ShowMessage('Somebody Tabbed?');
end;
inherited;
end;
Also, make sure to add the following line to your forms definition:

procedure CMDialogKey(Var Msg: TWMKey); message CM_DIALOGKEY;

Last Modified: 27-JUN-02