Delphi Programming

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

Catch a 'Tab Character' key stroke inside a TEdit

By Zarko Gajic, About.com

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

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

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

Delphi Programming

  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.