1. Home
  2. Computing & Technology
  3. Delphi Programming

Catch a 'Tab Character' key stroke inside a TEdit

By Zarko Gajic, About.com Guide

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:

~~~~~~~~~~~~~~~~~~~~~~~~~
//interface private
procedure CMDialogKey(Var Msg: TWMKey) ;
message CM_DIALOGKEY;
...
//implementation
procedure TForma.CMDialogKey(Var Msg: TWMKEY) ;
begin
   if (ActiveControl is TEdit) and
(Msg.Charcode = VK_TAB) then
   begin
    ShowMessage('TAB key pressed?') ;
   end;
   inherited;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Get paper formats for the default printer
« How to convert WMF to BMP

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Using VCL Components
  5. TEdit, TMaskEdit
  6. Catch a Tab Character key stroke inside a TEdit

©2009 About.com, a part of The New York Times Company.

All rights reserved.