cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Stenlund <>
Subject Handling dialog ENTER and ESC
Date Sun, 25 Sep 2011 08:42:20 GMT

I'm after a design/code pattern for handling ENTER and ESC for dialogs 
(modal) as well as PushButtons performing the same function. When I 
press ENTER or ESC the dialog is closed and I can find out in the 
DialogStateListener which one was pressed (true,false) which I guess is 
the default behaviour of pivot. There I can get the dialog result to see 
if I should "commit" or "rollback" the changes in the dialog or not ( I 
use Cayenne ORM). I also have pushbuttons in the dialog that will yield 
the same functionality, i.e. close the dialog and send a true/false result.

Now to my question, I was thinking of vetoing the close if the dialog 
values are not correct, but I cannot determine if it is ENTER, ESCAPE or 
the pushbuttons that caused the "close". I need to know that because if 
Cancel  or ESC was pressed I will never veto the close.

Hmm a little unstructured there, but how do you go about doing this i.e. 
handling the keyboard ENTER, ESC as well as pushbuttons that does the 
same functionality ?

Thanks for any help,


View raw message