[Gtk-sharp-list] retrieving the values behind a selected row
in a treeview
Jason Boutwell
jason.boutwell@comcast.net
08 Sep 2003 13:36:16 -0400
Whoops.
Yup. You're right. That should have read:
GLib.Value treeValue = null;
Jason
On Mon, 2003-09-08 at 17:14, Davy Brion wrote:
> On Monday 08 September 2003 16:55, Jason Boutwell wrote:
> > ----------------------------------
> >
> > TreeIter iter = new TreeIter();
> > TreeModel yourModel;
> > CustomObject yourValueObject = null;
> >
> > if (yourTreeView.Selection.GetSelected(out yourModel, ref iter)) {
> > GLib.Value treeValue = new GLib.Value();
> > int invisibleCol = 1;
> > yourModel.GetValue(iter, invisibleCol, out treeValue);
> > yourValueObject = (CustomObject) treeValue.Val;
> > }
> >
> > yourValueObject.getValue();
> >
> > -----------------------------------
> >
> > Works for me.
> >
> > Jason
> >
>
> Thanks!
>
> allthough, if i instantiante treeValue i get the following message at run-time
> everytime the code is run:
> ** (<unknown>:3887): CRITICAL **: file value.c: line 35
> (gtksharp_value_get_value_type): assertion `G_IS_VALUE (value)' failed
>
> but if i don't instantiate treeValue in that example (out parameters don't
> necessarily have to be instantiated before they are passed along to a
> method), it works perfectly and without any messages.
>
> thanks for helping me out :)
>
> kind regards,
> davy brion
>
>