dcl closes on hitting enter...

Started by Hypersonic, December 31, 2007, 10:55:01 AM

Previous topic - Next topic

Hypersonic

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!

owenwengerd

Try setting the text box 'ReturnAsTab' property to 'True'.
Owen Wengerd (Outside The Box) / ManuSoft

Hypersonic


nwgeo

#3
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

owenwengerd

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. :)
Owen Wengerd (Outside The Box) / ManuSoft

nwgeo

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.

owenwengerd

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?
Owen Wengerd (Outside The Box) / ManuSoft

stephan_35

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 .
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

Fred Tomke

Hello,

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

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

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

stephan_35

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 ....  ;)
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

Fred Tomke

Hello,

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

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

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