Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to prevent dialogs from being closed on ESC pressed
https://www.eclipse.org/forums/index.php/mv/msg/145860/459154/#msg_459154
Originally posted by: sarek.nurfuerspam.de
Hi,
is there a way to prevent dialogs from being closed when the ESC key is
pressed?
I create the dialog with the styles TRIM_DIALOG and APPLICATION_MODAL
and have a table and tableEditor component in it.
Now I want the table editor to react in a certain way when the user
presses the ESC key to discard the changes, he is currently performing
on the table cell. As editor I show a Text component, which has a key
listener attached to it. I tried to catch the ESC key in this listener,
but when the ESC key is pressed, the dialog closes immediately, which is
not what I want.
Can anyone give me any hint?
TIA
Christian
--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net]]>2005-08-02T17:59:54-00:00Re: How to prevent dialogs from being closed on ESC pressed
https://www.eclipse.org/forums/index.php/mv/msg/145860/459155/#msg_459155
I am not sure, but if you use JFace Dialog, you can try use different
button id than CANCEL_ID.
Hm... May be this will not help...
Look in class Decorations (in Win32 version), method WM_HOTKEY(). It
checks for SWT.CLOSE style of Shell, so create dialog without this style
(setShellStyle() method) and close it yourself using method close().
> is there a way to prevent dialogs from being closed when the ESC key is
> pressed?
>
> I create the dialog with the styles TRIM_DIALOG and APPLICATION_MODAL
> and have a table and tableEditor component in it.
> Now I want the table editor to react in a certain way when the user
> presses the ESC key to discard the changes, he is currently performing
> on the table cell. As editor I show a Text component, which has a key
> listener attached to it. I tried to catch the ESC key in this listener,
> but when the ESC key is pressed, the dialog closes immediately, which is
> not what I want.
>
> Can anyone give me any hint?
>
> TIA
>
> Christian]]>Konstantin Scheglov2005-08-02T18:19:27-00:00Re: How to prevent dialogs from being closed on ESC pressed
https://www.eclipse.org/forums/index.php/mv/msg/145860/459168/#msg_459168
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet4.java?rev=HEAD&am p;content-type=text/vnd.viewcvs-markup
"Christian Riedel" <sarek@nurfuerspam.de> wrote in message
news:dcocar$bv5$1@news.eclipse.org...
> Hi,
>
> is there a way to prevent dialogs from being closed when the ESC key is
> pressed?
>
> I create the dialog with the styles TRIM_DIALOG and APPLICATION_MODAL
> and have a table and tableEditor component in it.
> Now I want the table editor to react in a certain way when the user
> presses the ESC key to discard the changes, he is currently performing
> on the table cell. As editor I show a Text component, which has a key
> listener attached to it. I tried to catch the ESC key in this listener,
> but when the ESC key is pressed, the dialog closes immediately, which is
> not what I want.
>
> Can anyone give me any hint?
>
> TIA
>
> Christian
> --
> To reply to this posting directly use the following address and
> remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net]]>Steve Northover2005-08-02T19:39:19-00:00Re: How to prevent dialogs from being closed on ESC pressed
https://www.eclipse.org/forums/index.php/mv/msg/145860/459173/#msg_459173
Originally posted by: sarek.nurfuerspam.de
Thanks a lot! That was exactly what I was looking for - works great
Christian
--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net]]>2005-08-03T07:25:23-00:00