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

Catch a 'Tab Character' key stroke inside a TEdit

By , 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

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. 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.