OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: kos on October 08, 2009, 01:38:28 AM

Title: Press Enter :: OK or Cancel
Post by: kos on October 08, 2009, 01:38:28 AM
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?
Title: Re: Press Enter :: OK or Cancel
Post by: Fred Tomke on October 08, 2009, 03:26:50 AM
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
Title: Re: Press Enter :: OK or Cancel
Post by: owenwengerd on October 08, 2009, 06:12:57 AM
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.
Title: Re: Press Enter :: OK or Cancel
Post by: kos on October 08, 2009, 06:54:43 AM
Thanks, gays. Your help was very useful...