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).
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.
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.
Originally Posted by (CrashDome @ Aug. 25 2007,02:18)
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.