tags:

views:

246

answers:

1

How can I hide a Gtk# window that I created in MonoDevelop? I tried the following but it doesn't work:

public MainWindow (): base (Gtk.WindowType.Toplevel)
{
    Build();
    this.HideAll();
    this.Visible = false;
}


Solution Calling HideAll() outside the constructor, as tomlog suggested, works. If you want to do some work before showing the window you can

  • Add an event handler to Window.Shown before calling Build()
  • Do the work before calling Build() (probably the better alternative in most cases)
+1  A: 

I don't think you can call HideAll in the constructor, because the form is not fully initialized and therefore not visible yet.

tomlog