[Gtk-sharp-list] treeview toggled not changing

Rachel Hestilow rachel@nullenvoid.com
14 Jun 2003 07:42:21 -0500


--=-LSgrDwW31urz6erqYJDG
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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);
> }
>=20
> 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 =3D (bool) store.GetValue(iter, 0);
		store.SetValue(iter, 0, !val);
	}
}

  The view will receive a notification of the changed value and update
the check mark accordingly.

--=20
Rachel Hestilow <rachel@nullenvoid.com>

--=-LSgrDwW31urz6erqYJDG
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA+6xgqapOJdUj74F4RAji2AJwOtv+/BP5nwTWGZErMq56EuL5bfwCgnQhS
31pjEijdBlQs2dZ2bZK/fk4=
=i+Lz
-----END PGP SIGNATURE-----

--=-LSgrDwW31urz6erqYJDG--