Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to prevent dialogs from being closed on ESC pressed
How to prevent dialogs from being closed on ESC pressed [message #459154] Tue, 02 August 2005 17:59 Go to next message
Eclipse UserFriend
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
Re: How to prevent dialogs from being closed on ESC pressed [message #459155 is a reply to message #459154] Tue, 02 August 2005 18:19 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Christian Riedel:

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 Scheglov,
Google, Inc.
Re: How to prevent dialogs from being closed on ESC pressed [message #459168 is a reply to message #459154] Tue, 02 August 2005 19:39 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
See
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
Re: How to prevent dialogs from being closed on ESC pressed [message #459173 is a reply to message #459168] Wed, 03 August 2005 07:25 Go to previous message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi,

On 02.08.2005 21:39, Steve Northover wrote:
> See
> 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
>

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
Previous Topic:How can I add Table widgets into J9 ?
Next Topic:Wizard with 2 pages: how can I get information of the first page ?
Goto Forum:
  


Current Time: Fri Apr 19 21:55:47 GMT 2024

Powered by FUDForum. Page generated in 0.03748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top