Press Enter :: OK or Cancel

Started by kos, October 08, 2009, 01:38:28 AM

Previous topic - Next topic

kos

I create the form which consists of several textboxes for data entry and two buttons, OK and Cancel. At initialization of the form the focal point is installed on an OK button (it is provided by parameter Z/Order). If at once you press Enter dialogue end occurs on OK. But if to pass in what or other field (to enter any data in any textbox) pressing Enter ending dialogue by button Cancel...
Where an error?
Excuse me for my bad English...

Fred Tomke

Hi, kos, welcome to the forum.

I suggest to activate OnCancelClose event of the form.
Search the forum for the word "OnCancelClose" and you will find several samples to this.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

I suggest to use values for your buttons that are greater than the values for [Ok] (1) and [Cancel] (2).  In other words, your button handlers should call (dcl-Form_Close <my-form> N) where N > 2. Then you can easily distinguish the way that the dialog was closed.  [Enter] will return 1, [Esc] will return 2, and your button will return N.

If you don't want your dialog to close when the user presses [Enter], then handle the ReturnPressed event for the text boxes.
Owen Wengerd (Outside The Box) / ManuSoft

kos

Thanks, gays. Your help was very useful...
Excuse me for my bad English...