Capturing escape key for custom dialog

Discussion created by Extensitech on Oct 1, 2014
Latest reply on Oct 1, 2014 by keywords

It seems like this is probably a known issue, and if so, I apologize and just hope someone can point me to a solution. I couldn't find it.


When showing a custom dialog, if the user hits enter, option 1 is selected (and expected; after all, the first button is highlighted).


However, when the escape key is pressed, get ( lastmessagechoice ) also returns the default option (1), which is clearly not what the user intended. Get ( lasterror ) returns 0, so I have no indication that the user clearly either didn't want to pick one of the available options, or meant "cancel".


I realize that I could change all default options to be "cancel", but that would mean that A) there would always have to be a cancel button (I almost always want one anyway, but still ) and B) the user would always have to mouse to the most likely option (they couldn't use the enter key).


Has anyone come up with a way to differentiate between a user clicking escape and a user who selected option 1 by an intentional means?


I'd prefer to discover that I'm missing an obscure get functoin or something, but if this requires something gimmicky, or even a plugin, it would be worth it to me.


Chris Cain

Extensitech, LLC