Hi,

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. I use this 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. In this way I handle both ENTER, ESC and the pusbuttons the same way without having to listen to any keystrokes etc.

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

Hmm i'm a little unstructured here, but how do you go about doing this i.e. handling the keyboard ENTER, ESC as well as pushbuttons that does the same functionality ? Am I going about this in the wrong way, i.e. how to handle ENTER, ESC to make them perform the same

Thanks for any help,

Tomas

Reply via email to