OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Hypersonic on December 31, 2007, 10:55:01 AM

Title: dcl closes on hitting enter...
Post by: Hypersonic on December 31, 2007, 10:55:01 AM
When entering data into a text box, and if you hit enter, it closes the dialog.
Is there any way to stop this , and maybe make hit enter step to the next box?

Thanks!
Title: Re: dcl closes on hitting enter...
Post by: owenwengerd on December 31, 2007, 10:59:03 AM
Try setting the text box 'ReturnAsTab' property to 'True'.
Title: Re: dcl closes on hitting enter...
Post by: Hypersonic on December 31, 2007, 01:59:19 PM
Thanks Owen! ;D
Title: Re: dcl closes on hitting enter...
Post by: nwgeo on January 23, 2008, 10:26:42 AM
Thanks for the tip on trapping the "Enter" key being pressed, however I cannot seem to get the "OnReturnPressed" event to fire for a textbox control.  I have added the following lines to my LSP code for a text box that is to receive an address:

(defun c:Addr_frmAddr_txtAddrNum_OnReturnPressed ()
  (dcl_Control_SetFocus Addr_frmAddr_cmdFind)
  (princ "\nPressed <Enter> while in the txtAddrNum TEXT box...")
  (find_records)
);

After I type in an address, I would like to hit the "Enter" key and fire off the "find_records" function.  The function already behaves properly as I have already associated it with the "cmdFind_OnClicked" button. 


(defun c:Addr_frmAddr_cmdFind_OnClicked (/)
  (find_records)
);end CMDFIND_ONCLICKED



The "ReturnAsTab" property has been set to "True," as suggested.  This is confusing.  I am running version 4.1.0.10, AutoCAD Map 2004, WinXP, SP2
Title: Re: dcl closes on hitting enter...
Post by: owenwengerd on January 23, 2008, 01:07:59 PM
Quote from: nwgeo on January 23, 2008, 10:26:42 AM
Thanks for the tip on trapping the "Enter" key being pressed, however I cannot seem to get the "OnReturnPressed" event to fire for a textbox control.

If you need to respond when the user presses [Enter], you should set ReturnAsTab back to False and use a different approach.  Try responding to the [Enter] key press by handling the OnOK event, then cancel the dialog closing by responding to the OnCancelClose event.  If OnOK doesn't work, you can try the OnKeyDOwn event of the edit box. :)
Title: OnOK event
Post by: nwgeo on January 23, 2008, 02:02:07 PM
Well, the OnOK event didn't quite do what I wanted.  Also the OnKeyDown for the text box fired everytime I hit a key [like it's supposed to I guess], but this makes it impossible to enter a five digit address number as the event code gets fired five times :(

solution - I set the ReturnAsTab property back to True and changed the tab order so that the "Find Address" button follows directly after the address text box.  The user can hit the Return key twice, it's still faster than picking up the mouse just to click a button...

Still, I'm curious why I can't get the "ReturnPressed" event to fire in my application.  Oh well, Rev 2.0 I guess.

Thank you for responding to my post and giving me a few items to try.
Title: Re: OnOK event
Post by: owenwengerd on January 24, 2008, 02:30:53 AM
Quote from: nwgeo on January 23, 2008, 02:02:07 PM
the OnKeyDown for the text box fired everytime I hit a key [like it's supposed to I guess], but this makes it impossible to enter a five digit address number as the event code gets fired five times :(

Would this method work if your event handler ignored all the keys except the [Enter] key?
Title: Re: dcl closes on hitting enter...
Post by: stephan_35 on June 03, 2008, 02:45:54 AM
Hello,

I've got the same problem, but i still working with 4.1.2.1 odcl tools.

If i begin a new dailog box, whith an empty form, pressing [enter] key make dcl close.

There is no way to keep form alive ....

I find something for easy form .... I show again the form whith OnOk event ...

(defun c:GPE:PROJET_OnOK ( /)
     (dcl_Form_Show "boite.projet" "GPE:PROJET")
)


But still working with simple form .
Title: Re: dcl closes on hitting enter...
Post by: Fred Tomke on June 03, 2008, 05:17:16 AM
Hello,

have a look at OnCancelClose.
If you need an example, tell me.

Fred
Title: Re: dcl closes on hitting enter...
Post by: stephan_35 on June 03, 2008, 05:31:02 AM
Quote from: Fred Tomke on June 03, 2008, 05:17:16 AM
Hello,

have a look at OnCancelClose.
If you need an example, tell me.

Fred

Hello Fred,

Yes, because,i tried many times with all options existing in a default frame, but [Enter] key make it close !

Is there any option, like "isdefault" option in dcl, to tell than i want to put a button as default ????

I will be very please, if you can show me how to not close a frame with [enter] key pressed, with a blank frame for example ...   :P

Thanks ....  ;)
Title: Re: dcl closes on hitting enter...
Post by: Fred Tomke on June 03, 2008, 01:28:29 PM
Hello,

please try the attached project. Unfortunately, I've never seen that OnOk was called. Mostly I use it with Textbox.

Fred