Ctrl+s switches dirty to true [message #465732] |
Wed, 04 April 2007 07:44 |
Eclipse User |
|
|
|
Originally posted by: petra.k.geoaxon.com
Hi!
I'm implementing an editor with text controls. Whenever something is
changed, dirty should be set to true. For this I added a TextKeyListener
to all the text controls.
Problem is, when saving my data using Ctrl+s, it saves the data, but also
triggers the setDirty(true) call in my keyReleased method of the
TextKeyListener class. I want to avoid that, in order to allow a user to
save by pressing Ctrl+s.
I already tried adding something like this to the keyReleased method:
if (!(e.stateMask==SWT.CTRL && (e.character=='s'||e.character=='S')))
setDirty(true);
(I think this must be wrong... :-(
Any other ideas, please share with me! Thanks for the help.
|
|
|
Re: Ctrl+s switches dirty to true [message #465759 is a reply to message #465732] |
Wed, 04 April 2007 17:16 |
Eclipse User |
|
|
|
Originally posted by: bugjester.yahoo.com
I usually use a ModifyListener instead of a TextKeyListener to watch for
Text control changes. I think that will solve your problem.
> I'm implementing an editor with text controls. Whenever something is
> changed, dirty should be set to true. For this I added a TextKeyListener
> to all the text controls.
|
|
|
Re: Ctrl+s switches dirty to true [message #465770 is a reply to message #465759] |
Thu, 05 April 2007 03:58 |
Eclipse User |
|
|
|
Originally posted by: petra.k.geoaxon.com
Thanks, Steve, that will definitely solve the problem. I just needed a
fresh pair of eyes (and brains!) :-)
> I usually use a ModifyListener instead of a TextKeyListener to watch for
> Text control changes. I think that will solve your problem.
|
|
|
Powered by
FUDForum. Page generated in 0.03427 seconds