[Gtk-sharp-list] Custom (subclassed) widget fails to show up
in Glade based application
jymdman at home.se
Sat Oct 15 07:30:58 EDT 2005
I don't think you can use the same widget at two places.
You have to create two versions of the treeview.
But you can use the same treemodel to more than one treeview.
lör 2005-10-15 klockan 12:49 +0200 skrev Sebastian:
> Hello everybody,
> I use a .glade file to load all main parts of the GUI, including a few
> tabs. As I need the same TreeView in some of the tabs, I manually wrote
> a subclass, looking like this:
> public class
> MyListView : Gtk.ScrolledWindow
> private TreeView tv;
> public MyListView ()
> : base ()
> tv = new TreeView ();
> // ... do TreeView initialization, populate treeview, etc.
> tv.WidthRequest = 240;
> WidthRequest = 250;
> Child = tv;
> In Glade, I have constructed a HPaned in one tab and a VBox in another
> tab. In the VBox I just put one label, and the HPaned I left empty on
> the left side.
> The main program initialization is this:
> private void Init ()
> Glade.XML gxml = new Glade.XML ("myprogram.glade",
> "MainWindow", null);
> gxml.Autoconnect (this);
> /* Setup the view tree
> MyListView mlv = new MyListView ();
> tab1Pane.Pack1 (mlv, true, false);
> tab2VBox.PackEnd (mlv);
> // **A
> Using this starts up the GUI but leaves the HPaned empty and the VBox
> with just the label. I tried inserting a "mlv.Show ()" and "mlv.Realize
> ()" at the **A marked place, but it failed, giving the error message:
> (<unknown>:6496): Gtk-CRITICAL **: gtk_widget_realize: assertion
> `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
> I am at loss about Gtk internals and did not find a single example of
> how to properly setup a subclassed custom widget with a glade-based
> application (I have used manual subclassing in non-glade gtk# apps
> What do I miss?
> Gtk-sharp-list maillist - Gtk-sharp-list at lists.ximian.com
More information about the Gtk-sharp-list