[Gtk-sharp-list] retrieving the values behind a selected row in a treeview
Davy Brion
davy.brion@pandora.be
Mon, 8 Sep 2003 21:14:03 +0000
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