[Gtk-sharp-list] Extending Gtk.Window
Miguel de Icaza
miguel@ximian.com
Thu, 20 Nov 2003 16:37:18 -0500
Hello,
> If I dont create a Window object (for class2, the son), why it's so
> necesary to create a Gtk.Window object for the main window or my app
> will crash every time I try to 'show' it.
>
> Yeah, I have a function called: ShowWindow (that is public) and I close
> the window with this.Hide() and try to show it again checking if it's
> Visible or not, but doesn't matters cause it crashes.
There are a few problems with your code:
* The instance that is created by Glade is not of type AccountsWindow,
it is of type `Window'.
* You are not allowed to assign to `this', MCS flags that as an error,
you might be using an old version, and that explains the corruption.
I would suggest that you do have a container class that holds all the
information, but does not necessarily derive from Window:
class AccountsWindow {
[GtkWidget] Window accountsWindow;
public AccountsWindow ()
{
Glade.XML gui = new Glade.XML (...);
gui.AutoConnect (this);
}
}