Main Window disposal

75 views
Skip to first unread message

Jeff Halverson

unread,
Mar 31, 2013, 9:57:53 AM3/31/13
to xwt-...@googlegroups.com
I can't seem to get the main window to dispose, is this a known problem or am I doing something wrong?  I followed the wiki example and still seem to get the same problem:
using System;
using Xwt;

class XwtDemo {
    [STAThread]
    static void Main ()
    {
        Application.Initialize ();
        var mainWindow = new Window (){
            Title = "Xwt Demo Application",
            Width = 500,
            Height = 400
        };
        mainWindow.Show ();
        Application.Run ();
        mainWindow.Dispose ();
    }
}
I'm running with the Gtk backend on Ubuntu Monodevelop (3.0.4).  Also, it appears that Monodevelop highlights the "Dispose()" after mainWindow when in the IDE, but running the program does not necessarily result in a compile error...


Lluis Sanchez Gual

unread,
Apr 2, 2013, 1:27:41 PM4/2/13
to xwt-...@googlegroups.com
What do you mean the window is not disposed? it doesn't go away? the application doesn't end?

--
You received this message because you are subscribed to the Google Groups "XWT Widget Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xwt-list+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jeff Halverson

unread,
Apr 3, 2013, 2:48:25 AM4/3/13
to xwt-...@googlegroups.com
Sorry, was not very clear.  I run it inside Monodevelop, in a project with multiple solutions (so it has multiple run-points), and run it with a right-click "Run Item" selection.  Now that I think about it, maybe it was not Xwt, but something with Monodevelop 3.0.4 that is causing this.  When I get home again I will recheck and see if this problem still happens if I have a simple single solution project.

Jeff Halverson

unread,
Apr 3, 2013, 8:16:34 AM4/3/13
to xwt-...@googlegroups.com
I have just confirmed that if I make a simple example with just basic application, it appears to do the same thing.  If I run the program, then close with the windows close button, the window will disappear, but the process remains running.  I have checked to ensure it is still running with "ps -ax", and is shows on the monitor.

I have also tested not using Monodevelop, but just run the compiled program from the command line, and it still seems to close the window, but leave the process running.  I then have to run a "kill" to remove this process.

Jeff Halverson

unread,
Apr 6, 2013, 12:57:33 AM4/6/13
to xwt-...@googlegroups.com
I have determined that in order to handle an application close appropriately, you need to add in an event as such to your main application window:

    this.CloseRequested += HandleCloseRequested;

Then, you can make the handle like this:

    void HandleCloseRequested (object sender, CloseRequestedEventArgs args)
{
Application.Exit ();
}

Is this by design, or is this something that should have happened automatically on a close request?

Jeha

Lluis Sanchez Gual

unread,
Apr 7, 2013, 4:06:12 AM4/7/13
to xwt-...@googlegroups.com
Right the application has to be explicitly exited, but I have to review that behavior, since different platforms may do different things.


Jeha
Reply all
Reply to author
Forward
0 new messages