Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Listening to Shell closing before dispose
Listening to Shell closing before dispose [message #440690] |
Fri, 06 August 2004 11:38 |
Eclipse User |
|
|
|
Originally posted by: manu.mopot.de
Hi,
i am searching for a way to be notified when the users closes the shell, but
before any widgets have been disposed in response to that. using a
DisposeListener or a ShellListener both results in a SWTError: widget is
disposed.
any suggestions?
thanks
manu
|
|
| |
Re: Listening to Shell closing before dispose [message #440693 is a reply to message #440691] |
Fri, 06 August 2004 12:57 |
Eclipse User |
|
|
|
Originally posted by: manu.mopot.de
hi,
yes that was what i had expected before, but when i do it like this and try
to access any of the Shell?s widgets inside the handleEvent method, i get
the SWTError saying that the widget has been disposed. thats strange...
manu
"william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
news:cevtc8$e8b$1@eclipse.org...
> hi
>
> i think that what you want :
> shell.addListener(SWT.Close, new Listener(){
> public void handleEvent(Event event) {
> event.doit=false;
> //your code here
>
> }
> });
> the listener allow to prevent the shell to close
> so if you pass througth the listener you'll be notified when the users
> attempt to close it
>
>
> Manu Robledo wrote:
>
> > Hi,
>
> > i am searching for a way to be notified when the users closes the shell,
but
> > before any widgets have been disposed in response to that. using a
> > DisposeListener or a ShellListener both results in a SWTError: widget is
> > disposed.
>
> > any suggestions?
>
> > thanks
>
> > manu
>
>
|
|
|
Re: Listening to Shell closing before dispose [message #440695 is a reply to message #440693] |
Fri, 06 August 2004 13:09 |
william Messages: 15 Registered: July 2009 |
Junior Member |
|
|
yes, that's very strange because i use this code, and after
event.doit=false, i open a messagebox on the shell of the widget...
i don't understand, maybe you can try to clean your project (sometimes it
works) or post a part of your code....
Manu Robledo wrote:
> hi,
> yes that was what i had expected before, but when i do it like this and try
> to access any of the Shell?s widgets inside the handleEvent method, i get
> the SWTError saying that the widget has been disposed. thats strange...
> manu
> "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> news:cevtc8$e8b$1@eclipse.org...
> > hi
> >
> > i think that what you want :
> > shell.addListener(SWT.Close, new Listener(){
> > public void handleEvent(Event event) {
> > event.doit=false;
> > //your code here
> >
> > }
> > });
> > the listener allow to prevent the shell to close
> > so if you pass througth the listener you'll be notified when the users
> > attempt to close it
> >
> >
> > Manu Robledo wrote:
> >
> > > Hi,
> >
> > > i am searching for a way to be notified when the users closes the shell,
> but
> > > before any widgets have been disposed in response to that. using a
> > > DisposeListener or a ShellListener both results in a SWTError: widget is
> > > disposed.
> >
> > > any suggestions?
> >
> > > thanks
> >
> > > manu
> >
> >
|
|
|
Re: Listening to Shell closing before dispose [message #440697 is a reply to message #440695] |
Fri, 06 August 2004 13:28 |
Eclipse User |
|
|
|
Originally posted by: manu.mopot.de
ok, this is what i am doing:
getShell().addListener(SWT.Close, new Listener() {
public void handleEvent(Event e){
e.doit = false;
System.out.println(e.widget);
}
});
and this is what i get when closing the shell:
Shell {*Disposed*}
this means that
a) the shell is already disposed, when handleEvent() is called and
b) the e.doit doen't have any effect.
could this depend on the OS or the SWT version? i am using win xp and swt
3.0...
hm... no more ideas.
manu
"william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
news:cevvu3$j5v$1@eclipse.org...
> yes, that's very strange because i use this code, and after
> event.doit=false, i open a messagebox on the shell of the widget...
> i don't understand, maybe you can try to clean your project (sometimes it
> works) or post a part of your code....
>
> Manu Robledo wrote:
>
> > hi,
>
> > yes that was what i had expected before, but when i do it like this and
try
> > to access any of the Shell?s widgets inside the handleEvent method, i
get
> > the SWTError saying that the widget has been disposed. thats strange...
>
> > manu
>
> > "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> > news:cevtc8$e8b$1@eclipse.org...
> > > hi
> > >
> > > i think that what you want :
> > > shell.addListener(SWT.Close, new Listener(){
> > > public void handleEvent(Event event) {
> > > event.doit=false;
> > > //your code here
> > >
> > > }
> > > });
> > > the listener allow to prevent the shell to close
> > > so if you pass througth the listener you'll be notified when the users
> > > attempt to close it
> > >
> > >
> > > Manu Robledo wrote:
> > >
> > > > Hi,
> > >
> > > > i am searching for a way to be notified when the users closes the
shell,
> > but
> > > > before any widgets have been disposed in response to that. using a
> > > > DisposeListener or a ShellListener both results in a SWTError:
widget is
> > > > disposed.
> > >
> > > > any suggestions?
> > >
> > > > thanks
> > >
> > > > manu
> > >
> > >
>
>
|
|
|
Re: Listening to Shell closing before dispose [message #440699 is a reply to message #440697] |
Fri, 06 August 2004 13:55 |
william Messages: 15 Registered: July 2009 |
Junior Member |
|
|
i did the same thing in my code and it works...
my code :
progressShell.addListener(SWT.Close, new Listener(){
public void handleEvent(Event event) {
if (v.isAlive()){ //v is a runnable and while he's running, the window
can't be close
//disable close
event.doit=false;
//pop up error
MessageBox msg = new...
}
}
});
the only difference is that i add the listener directly on the shell (not
by using getShell()), so maybe the error come from this call..
(and it's totaly independant of the platform, i'm developping an
application with linux and she works fine with win xp (using SWT3.0))
Manu Robledo wrote:
> ok, this is what i am doing:
> getShell().addListener(SWT.Close, new Listener() {
> public void handleEvent(Event e){
> e.doit = false;
> System.out.println(e.widget);
> }
> });
> and this is what i get when closing the shell:
> Shell {*Disposed*}
> this means that
> a) the shell is already disposed, when handleEvent() is called and
> b) the e.doit doen't have any effect.
> could this depend on the OS or the SWT version? i am using win xp and swt
> 3.0...
> hm... no more ideas.
> manu
> "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> news:cevvu3$j5v$1@eclipse.org...
> > yes, that's very strange because i use this code, and after
> > event.doit=false, i open a messagebox on the shell of the widget...
> > i don't understand, maybe you can try to clean your project (sometimes it
> > works) or post a part of your code....
> >
> > Manu Robledo wrote:
> >
> > > hi,
> >
> > > yes that was what i had expected before, but when i do it like this and
> try
> > > to access any of the Shell?s widgets inside the handleEvent method, i
> get
> > > the SWTError saying that the widget has been disposed. thats strange...
> >
> > > manu
> >
> > > "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> > > news:cevtc8$e8b$1@eclipse.org...
> > > > hi
> > > >
> > > > i think that what you want :
> > > > shell.addListener(SWT.Close, new Listener(){
> > > > public void handleEvent(Event event) {
> > > > event.doit=false;
> > > > //your code here
> > > >
> > > > }
> > > > });
> > > > the listener allow to prevent the shell to close
> > > > so if you pass througth the listener you'll be notified when the users
> > > > attempt to close it
> > > >
> > > >
> > > > Manu Robledo wrote:
> > > >
> > > > > Hi,
> > > >
> > > > > i am searching for a way to be notified when the users closes the
> shell,
> > > but
> > > > > before any widgets have been disposed in response to that. using a
> > > > > DisposeListener or a ShellListener both results in a SWTError:
> widget is
> > > > > disposed.
> > > >
> > > > > any suggestions?
> > > >
> > > > > thanks
> > > >
> > > > > manu
> > > >
> > > >
> >
> >
|
|
|
Re: Listening to Shell closing before dispose [message #440707 is a reply to message #440690] |
Fri, 06 August 2004 15:15 |
Eclipse User |
|
|
|
Originally posted by: amondel1.hotmail.com
I had this same problem a while back and I eventually solved the problem
by creating a component called disposecomment create that as my first
component and have a dispose listener for that...and then it will cause
the listener to be called before any of your components get destroyed
later,
whatsgoingon
|
|
|
Re: Listening to Shell closing before dispose [message #440809 is a reply to message #440707] |
Fri, 06 August 2004 18:30 |
Eclipse User |
|
|
|
Originally posted by: manu.mopot.de
thanks, that could be a workaround, but still i won?t be able to prevent the
shell from being disposed and that was what i also have to do...
manu
"whatsgoingon" <amondel1@hotmail.com> schrieb im Newsbeitrag
news:cf07aq$pr$1@eclipse.org...
> I had this same problem a while back and I eventually solved the problem
> by creating a component called disposecomment create that as my first
> component and have a dispose listener for that...and then it will cause
> the listener to be called before any of your components get destroyed
>
> later,
> whatsgoingon
>
|
|
| |
Re: Listening to Shell closing before dispose [message #440888 is a reply to message #440699] |
Mon, 09 August 2004 14:00 |
Eclipse User |
|
|
|
Originally posted by: bram.eresmas.net
Great! I needed this option: preventing from shell closing! And it really
works! Thanks!! :)
bramez
william wrote:
> i did the same thing in my code and it works...
> my code :
> progressShell.addListener(SWT.Close, new Listener(){
> public void handleEvent(Event event) {
> if (v.isAlive()){ //v is a runnable and while he's running, the window
> can't be close
> //disable close
> event.doit=false;
> //pop up error
> MessageBox msg = new...
> }
> }
> });
> the only difference is that i add the listener directly on the shell (not
> by using getShell()), so maybe the error come from this call..
> (and it's totaly independant of the platform, i'm developping an
> application with linux and she works fine with win xp (using SWT3.0))
> Manu Robledo wrote:
> > ok, this is what i am doing:
> > getShell().addListener(SWT.Close, new Listener() {
> > public void handleEvent(Event e){
> > e.doit = false;
> > System.out.println(e.widget);
> > }
> > });
> > and this is what i get when closing the shell:
> > Shell {*Disposed*}
> > this means that
> > a) the shell is already disposed, when handleEvent() is called and
> > b) the e.doit doen't have any effect.
> > could this depend on the OS or the SWT version? i am using win xp and swt
> > 3.0...
> > hm... no more ideas.
> > manu
> > "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> > news:cevvu3$j5v$1@eclipse.org...
> > > yes, that's very strange because i use this code, and after
> > > event.doit=false, i open a messagebox on the shell of the widget...
> > > i don't understand, maybe you can try to clean your project (sometimes it
> > > works) or post a part of your code....
> > >
> > > Manu Robledo wrote:
> > >
> > > > hi,
> > >
> > > > yes that was what i had expected before, but when i do it like this and
> > try
> > > > to access any of the Shell?s widgets inside the handleEvent method, i
> > get
> > > > the SWTError saying that the widget has been disposed. thats strange...
> > >
> > > > manu
> > >
> > > > "william" <william.ferreira@laposte.net> schrieb im Newsbeitrag
> > > > news:cevtc8$e8b$1@eclipse.org...
> > > > > hi
> > > > >
> > > > > i think that what you want :
> > > > > shell.addListener(SWT.Close, new Listener(){
> > > > > public void handleEvent(Event event) {
> > > > > event.doit=false;
> > > > > //your code here
> > > > >
> > > > > }
> > > > > });
> > > > > the listener allow to prevent the shell to close
> > > > > so if you pass througth the listener you'll be notified when the
users
> > > > > attempt to close it
> > > > >
> > > > >
> > > > > Manu Robledo wrote:
> > > > >
> > > > > > Hi,
> > > > >
> > > > > > i am searching for a way to be notified when the users closes the
> > shell,
> > > > but
> > > > > > before any widgets have been disposed in response to that. using a
> > > > > > DisposeListener or a ShellListener both results in a SWTError:
> > widget is
> > > > > > disposed.
> > > > >
> > > > > > any suggestions?
> > > > >
> > > > > > thanks
> > > > >
> > > > > > manu
> > > > >
> > > > >
> > >
> > >
|
|
|
Goto Forum:
Current Time: Sat May 11 00:07:56 GMT 2024
Powered by FUDForum. Page generated in 0.04739 seconds
|