Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to change key input 1

Status
Not open for further replies.

john230873

Programmer
Oct 3, 2003
89
NZ
I have a Dbgrid box and I want the Enter key to have the same behavior as when a user presses the tab key, I thought this would do it but it doesn't seem to work.

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
If Key = #13 then Key := #9;
inherited KeyPress (Key);
end;

 
that's because the dbgrid acted already onto the OnkeyDown Event which comes BEFORE the OnKeyPress Event. just use this same technique in the OnKeyDown Event and it should be fine.

Cheers

--------------------------------------
What You See Is What You Get
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top