Jump to content
Sign in to follow this  
dr_eyeball

Prevent Esc key closing dialog

Recommended Posts

Looking for advice on how to prevent the Escape key from closing a dialog.

Possible solutions: I'm guessing it would somehow be done via User_Interface_Event_Handlers, which are easy enough, but I still don't know how to prevent the closure.

Perhaps it's controlled via a return value in one of the functions or EH's?

Situation: After having no success from this child dialogs discussion, I have resorted to combining 2 dialogs into 1. I have nested a popup menu dialog into another commander dialog and the instinct is to press Esc to close the menu, but that will close the commander dialog too. Instead I want to close dialogs only via a ["X"] close icon in the window/menu title bar (or some other controlled manner).

Example: Screenshot

th_ICE_CommandModule3.jpg

Long discussion for a simple question...

Share this post


Link to post
Share on other sites

You cant avoid the dialog being closed if Esc was pressed I would say. But you can re-create the dialog as soon as the dialog was closed and the user wont notice that. You should use the onUnload eventhandler to save the current selected item in the listbox and to start the dialog again.

Share this post


Link to post
Share on other sites

i use a simple spawned loop, checking for dialog=true...

as become false, it will throw a "Don't ESC Dialog" Message and fire the startdialog-function again...

as you use a framework, hmmm ... the only way i can suggest is that your framework keeps current state in a global variable, and needs a capability to restore settings from it ... so on close you can restore last saved settings & lbcursel and focuses ...

kind of additional work, but offers a good debugging capability, too.

Regards,

zap

Share this post


Link to post
Share on other sites

yes ... disableuserinput won't do it ..

it's kind of tricky in this case.

Share this post


Link to post
Share on other sites

Disabling the ESC key would suck for a player. How am I supposed to exit the game should I want to? I wouldn't use ANY dialog that didn't let me ESC.

Why do you need to disable it? So you can force them to click many X's? If ESC closes everything, I say let the player learn the hard way NOT to hit ESC if they don't mean to.

Share this post


Link to post
Share on other sites
Disabling the ESC key would suck for a player. How am I supposed to exit the game should I want to? I wouldn't use ANY dialog that didn't let me ESC.

Why do you need to disable it? So you can force them to click many X's? If ESC closes everything, I say let the player learn the hard way NOT to hit ESC if they don't mean to.

Read the entire first post, before replying. Nobody is trying to disable Esc key solely for the purpose of preventing closing dialogs.

When 2 dialogs are nested into 1, you sometimes want to detect that Esc has been pressed in order to close your sub-dialog and leave the pseudo parent dialog open. Is that so unreasonable? You then press Esc again to close the pseudo parent dialog.

Share this post


Link to post
Share on other sites

agree with dr. eyeball ... esc will you lead through opened dialog layers until you reach the arma hardcoded layer... the simple esc~respawn dialogue...

the whatabout is, what happenz as the "map-engine" dialog was escaped ... that means current dialog 0 (+x)

@Eyeball ... did you find a solution??

@CrashDome ... howto create rounded corners smile_o.gif

regards,

zap

Share this post


Link to post
Share on other sites

Why not make the pop-up dialogue part of the main dialogue and use ctrlshow to pop it up when you need it.

--Ben

Share this post


Link to post
Share on other sites
Read the entire first post, before replying. Nobody is trying to disable Esc key solely for the purpose of preventing closing dialogs.

um....

Quote[/b] ]Looking for advice on how to prevent the Escape key from closing a dialog.

huh.gif

Sorry, but those phrases looked like exact opposites to me.

Either way, I still stand by my advice that the ability to alter the effects of ESC key is contradictory to the purpose and behavior it was intended for. You can program any other key ('X' perhaps?) to close a child dialog. Why *must* it be ESC?

Share this post


Link to post
Share on other sites

Total thread necromancy, but as far as I know you can override any arma key input by detecting the keypress with a displayeventhandler and simply returning *true* as the function's return value. Thanks to Spooner for demonstrating how to do that. smile_o.gif

http://community.bistudio.com/wiki/displaySetEventHandler

I'm using this trick to prevent esc from closing the child dialog and the main one; it'll only close the child if you're in the child, and the main if you're in the main.

I haven't tested this just yet, but it should work. I'll repost if it somehow fails...

Hopefully this tip will help someone out who needs it. smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×