[Gtk-sharp-list] treeview toggled not changing
George Farris
george@gmsys.com
14 Jun 2003 08:58:43 -0700
On Sat, 2003-06-14 at 05:42, Rachel Hestilow wrote:
> On Sat, 2003-06-14 at 01:27, George Farris wrote:
> > public void enabled_toggled (object o, GtkSharp.ToggledArgs args)
> > {
> > Console.WriteLine("toggled {0}", args);
> > }
> >
> > The enabled_toggled works when I click the little checkbox but the
> > actual gui state doesn't change when clicked, the check mark never
> > disappears. Is it supposed to be changed manually with the signal? I
> > would have thought it would just change when clicked.
>
> Hi George,
> The TreeView actually works differently here than you might expect.
> Since it is Model-View-Controller based, the view will never directly
> modify the model (in this case, toggling the actual boolean value).
> Instead you need to update the model value once you receive the toggled
> callback, like so:
>
> public void enabled_toggled (object o, GtkSharp.ToggledArgs args)
> {
> Console.WriteLine("toggled {0}", args);
>
> Gtk.TreeIter iter;
> if (store.GetIterFromString(out iter, args.Path))
> {
> bool val = (bool) store.GetValue(iter, 0);
bool val = store.GetValue(iter, 0);
doesn't seem to work I had to do this:
GLib.Value val = new GLib.Value();
store.GetValue(iter, 0, out val);
Is this something new in the cvs version of gtk-sharp? I'm using 0.9.
Thanks
--
George Farris <george@gmsys.com>