[Gtk-sharp-list] [part 2] Overloaded method fails in Gtk .14
Peter Williams
peter@newton.cx
Wed, 03 Dec 2003 16:23:44 -0500
Hi Pablo,
On Wed, 2003-12-03 at 14:04, Pablo Fischer wrote:
> What the ***!!, I've also tried with:
>
> GLib.Value = null;
>
> and compiles.. but when I try to run it, it crashes :).
Again, the compiler is always right: you need to initialize your
GLib.Value. But the GetValue () function can't initialize that variable
itself; you need to create an non-null but empty GLib.Value, which
GetValue can then set.
GLib.Value value = new Value ();
sel.GetSelected (out model, out iter);
model.GetValue (iter, 0, value);
You may also be interested in the GetValue (iter, column) function,
which returns an the Val property of a temporary GLib.Value, making your
code cleaner:
sel.GetSelected (out model, out iter);
object value = model.GetValue (iter, 0);
Peter
--
Peter Williams peter@newton.cx
"[Ninjas] are cool; and by cool, I mean totally sweet."
-- REAL Ultimate Power