Re: [Java-gnome-developer] Glade with multiple gtk windows or dialog
Brought to you by:
afcowie
From: alcapcom <alc...@gm...> - 2006-07-11 16:15:24
|
> Are you sure that defaultContrutor is being called? Shame on me! It was well a problem of contructor not called. Thanks. 2006/7/11, Mark Howard <mh...@ti...>: > Are you sure that defaultContrutor is being called? (You didn't paste > any code that calls it and it does have an unusual name). Try adding > printlns for both calls to defaultContrutor and lifeCycleQuery to > check what's actually happening. > > On 7/11/06, alcapcom <alc...@gm...> wrote: > > Thank's for the reply Andrew, > > > > Before posting i have already try to handle these event with the > > lifeCycleListener, but that did not work, I "re" try with your > > recommendation but I obtains the same errors. > > > > > If you post your code you'll probably make it easier for people to help > > > you. > > > > Here the code: > > > > Dialog Class: > > ... > > public Dialog dialog = (Dialog) glade.getWidget("dialog_display_manager"); > > ... > > public void defaultContrutor() { > > dialog.addListener(new LifeCycleListener() { > > public void lifeCycleEvent(LifeCycleEvent event) { > > } > > public boolean lifeCycleQuery(LifeCycleEvent event) { > > if (event.isOfType(LifeCycleEvent.Type.DESTROY) > > || event.isOfType(LifeCycleEvent.Type.DELETE)) { > > dialog.hide(); > > } > > return true; > > } > > }); > > } > > ... > > > > Window Class (Main): > > ... > > public Window window = (Window) glade.getWidget("window_main"); > > ... > > public void defaultConstructor() { > > window.addListener(new LifeCycleListener(){ > > public void lifeCycleEvent(LifeCycleEvent event) { > > } > > public boolean lifeCycleQuery(LifeCycleEvent event) { > > if (event.isOfType(LifeCycleEvent.Type.DESTROY) > > || event.isOfType(LifeCycleEvent.Type.DELETE)) { > > Gtk.mainQuit(); > > } > > return false; > > } > > }); > > } > > ... > > public static void on_button_add_display_clicked() { > > glade.getWidget("dialog_display_manager").show(); > > } > > ... > > > > -Alphonse > > > > ps: I use the last version provided on Fedora Core 5 (libgtk 2.8.5, > > libglade 2.12,glib 0.2.3). > > > > 2006/7/8, Andrew Cowie <an...@op...>: > > > On Wed, 2006-07-05 at 13:34 +0200, someone with no name wrote: > > > > When I try to open Dialog/Window after having already close it, I > > > > obtain the following errors. > > > ... > > > > I have try to intercepted delete_event and event_destroy without success. > > > > > > All you should have to trap is LifeCycleEvent.Type.DELETE in > > > lifeCylceQuery() of the LifeCycleListener. > > > > > > > I really do not see how not intercepted the signal to overload him > > > > with for example Window.hide (), or some thing like that. > > > > > > If you call the Window's hide() method, then the object will still be > > > live. When doing so, however, you have to return true to tell GTK that > > > you've handled it so that it does not continue to propagate the signal. > > > [This is important because the default handler for delete-event is to in > > > turn emit destroy-event with the default result that the Window is > > > destroyed] > > > > > > Did you return true? > > > > > > If you post your code you'll probably make it easier for people to help > > > you. > > > > > > AfC > > > London > > > > > > P.S. I just noticed that the JavaDoc for LifeCycleListener is mush, so > > > I'm fixing it. > > > > > > > > > > > > Using Tomcat but need to do more? Need to support web services, security? > > > Get stuff done quickly with pre-integrated technology to make your job easier > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > java-gnome-developer mailing list > > > jav...@li... > > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > |