BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

'escaping' the form

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
JED
Guest





PostPosted: Mon Oct 27, 2003 5:25 am    Post subject: Re: 'escaping' the form Reply with quote



Vladimir Ota wrote:

Quote:
event. While this works, is seems to me very clumsy way of doing it.
Unfortunately I couldn't come up with something better myself, so I
decided to ask if there is any better way?

The TButton component has a property called Cancel. When you set this
property to TRUE for a specific button, when the escape key is pressed
then that buttons OnClick event is also called.

Back to top
Vladimir Ota
Guest





PostPosted: Mon Oct 27, 2003 5:49 am    Post subject: 'escaping' the form Reply with quote



I have a (modal) form with a number of controls on it. I'd like to
quit the form (with mrCancel) when I press the esacpe key. Is there
any other way than assigning each component and the form a KeyPress
event. While this works, is seems to me very clumsy way of doing it.
Unfortunately I couldn't come up with something better myself, so I
decided to ask if there is any better way?
Back to top
Kurt Barthelmess
Guest





PostPosted: Mon Oct 27, 2003 10:15 am    Post subject: Re: 'escaping' the form Reply with quote



Vladimir Ota <lado (AT) prim-nov (DOT) si> wrote:

Quote:
I have a (modal) form with a number of controls on it. I'd like to
quit the form (with mrCancel) when I press the esacpe key. Is there
any other way than assigning each component and the form a KeyPress
event. While this works, is seems to me very clumsy way of doing it.
Unfortunately I couldn't come up with something better myself, so I
decided to ask if there is any better way?

As JED wrote, a Cancel button is the most direct route. The button can
be "hidden" by making it 0 pixels wide if that is an issue. Another
alternative would be a "hidden" menu item if th form has a menu.

Good luck.

Kurt


Back to top
Ian Kirk
Guest





PostPosted: Mon Oct 27, 2003 10:52 am    Post subject: Re: 'escaping' the form Reply with quote

"Kurt Barthelmess (TeamB)" <kbarthelmess (AT) compuserve (DOT) com> wrote

Quote:
Vladimir Ota <lado (AT) prim-nov (DOT) si> wrote:

As JED wrote, a Cancel button is the most direct route. The button can
be "hidden" by making it 0 pixels wide if that is an issue. Another
alternative would be a "hidden" menu item if th form has a menu.

Alternatively he could set KeyPreview := True for the form, and put the
Escape key handling in the form-level keypress handler.

Ian



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.