| View previous topic :: View next topic |
| Author |
Message |
JED Guest
|
Posted: Mon Oct 27, 2003 5:25 am Post subject: Re: 'escaping' the form |
|
|
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
|
Posted: Mon Oct 27, 2003 5:49 am Post subject: 'escaping' the form |
|
|
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
|
Posted: Mon Oct 27, 2003 10:15 am Post subject: Re: 'escaping' the form |
|
|
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
|
Posted: Mon Oct 27, 2003 10:52 am Post subject: Re: 'escaping' the form |
|
|
"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 |
|
 |
|