Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
pressing enter in editbox to perform action Posted by sarkiemarkie on 14 Feb 2006 at 12:15 PM
i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.
Report
Re: pressing enter in editbox to perform action Posted by RichardK on 14 Feb 2006 at 12:39 PM
This message was edited by RichardK at 2006-2-14 12:39:41

: i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.
:
Hi

This code should work. You are trying to intercept the on key press event.

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then //#13 = enter
begin
//----- Add Method Call in here -----
//just a line to prove it works
Messagebox(handle,'test','test',MB_Ok);
end;
end;




Report
Re: pressing enter in editbox to perform action Posted by sarkiemarkie on 14 Feb 2006 at 12:44 PM
: This message was edited by RichardK at 2006-2-14 12:39:41

: : i want to be able to press enter in a certain editbox when data is enetered and then call a procedure that can also be called by clicking a button, like a shortcut.
: :
: Hi
:
: This code should work. You are trying to intercept the on key press event.
:
: procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
: begin
: if Key = #13 then //#13 = enter
: begin
: //----- Add Method Call in here -----
: //just a line to prove it works
: Messagebox(handle,'test','test',MB_Ok);
: end;
: end;
:
:
:
:
: EXCELLENT, thank you!!




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.