I have a TEdit (VisualCLX Component) and I want to override the behaviour of the TAB Key in the onKeyPress event, but if I try to intercept the TAB key in the KeyPress event it doesn't work because the event is not fired when the tab key is pressed on the TEdit.
How can I intercept the TAB Key on KeyPress event of TEdit Control ?
Edit Events does not apply to navigation keys
Tab
as these do not trigger keyboard events. The only place which points to this fact. Delphi Help TCustomForm.KeyPreviewTo test put 3 TEdit (CLX) on a form And a TMemo.
The tab order is Edit1, Edit2, Edit3
The only event you can use is the KeyUp Event
press shift tab
Memo1 shows
Edit1KeyUp
Edit1KeyUp
press tab
Memo1 shows
Edit2KeyUp
press tab
Edit2.SetFocus;
we send the cursor back to edit2
Memo1 shows
Edit3KeyUp
So with the TAB key the user never can leave edit2
for example : In the Edit3KeyUp event you can add a #9 to to Edit2.Text.