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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catch Enter Key 1

Status
Not open for further replies.

tlhawkins

Programmer
Dec 28, 2000
797
US

I'm a VB programmer who is making the switch to Delphi.

Can someone help me catch an enter key in a tRichText box?

do I use OnKeyPress,OnKeyDown,OnKeyUp or what?

do I have to verify that the Enter key happened in the rTextBox?

what is the KeyCode for "Enter"? probably the same as VB... but I forgot.

Thanks.
 
If by tRichText box you mean a TRichEdit component, then you can "catch" the enter key by processing the OnKeyPress event and testing for #13:
[blue]
Code:
procedure TForm1.RichEdit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then Key := '?';
end;
[/color]


 
Thanks Zathras,

You guessed my meaning correctly. Thanks.
and the procedure works perfect.

-Travis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top