OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: Juerg W. Menzi on June 10, 2010, 12:00:09 AM

Title: Close modeless form by ESC key
Post by: Juerg W. Menzi on June 10, 2010, 12:00:09 AM
Hi all

Probably I've a hole in my brain... ;D
but how to close a modeless dialogue by ESC key if the dialogue has no focus?

Cheers
Title: Re: Close modeless form by ESC key
Post by: owenwengerd on June 10, 2010, 07:23:19 PM
The window with keybard input focus decides how to respond to the [Esc] key.  If that window is the AutoCAD command line, there are probably ways to translate [Esc] into a (dcl_Form_Close) call, but offhand I don't know what would be the best way to do that.
Title: Re: Close modeless form by ESC key
Post by: Juerg W. Menzi on June 11, 2010, 12:58:50 AM
Hi Owen

Thanks for the answer - seems to be a disadvantage of modeless dialogues.

Meanwhile I use a (partial) solution with a command reactor. If the user invokes an unused command (he needs only Zoom, Pan etc. during the modeless dialogue), the dialogue will be closed by this reactor - not perfect but usable.
It would be fine if AutoCAD would offer something like a KeyPressed reactor... 8)

Cheers
Title: Re: Close modeless form by ESC key
Post by: jmaeding on June 14, 2010, 11:07:01 AM
it seems like you would only want a modeless to close when doing something involving it.
If you draw a line, and hit escape, you do not want some dialog to close.
If you are running a command like "change color", and you has a modeless dialog with colors, then you could program in code to close that dialog if the user hits escape during the command.
I'm a bit surprised you want to close dialogs outside of commands that involve them.
maybe you want to close them during things like zoom and pan, but that will be very annoying to people suring the commands that do need them.
Can you explain a bit more what you are doing?
Title: Re: Close modeless form by ESC key
Post by: Juerg W. Menzi on June 15, 2010, 06:29:05 AM
Hi James

The only thing to use a modeless dialogue was to allow the user using zoom, pan, etc. during the dialogue. The first idea was to close the dialogue by ESC key, but no solution available. This was the reason to use a command reactor for close the dialogue if the user starts another command than zoom, pan, etc.

Cheers