> > There are several GUI framework authors who think user data is okay
> > given that GUI libs tend to have this feature including GTK+,
> > WinForms, WPF and Silverlight. See also:
> > http://stackoverflow.com/questions/1058635/common-uses-for-the-tag-property
> >
> > I've used this technique in other GUI libs without experiencing a
> > single problem. It's just an alternate way to stash data in an
> > existing object.
> The main problems with this approach are type safety and collisions.
> In the case of winforms, where each control has a Tag property, you

Agree, The UserData thing is kind of lousy.  But if you wrap it in
extension methods it can be used more gracefully.  Extension methods
can't add attributes [variables] but they can store and retrieve stuff
from UserData.

  public static class MyWidgetMethods
  {
    public static void MyMethod(this Gtk.Object widget, {some params})
    {
        {do stuff and use this.UserData here}
        return {whatever}
    }
  }

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to