On Thu, Nov 26, 2009 at 12:21 AM, Chuck Esterbrook
<[email protected]> wrote:
> Hi,
>
> I'd like to associate an arbitrary Mono/.NET object with a widget.
> Something like:
>    button.Data = "foo"
> or:
>    menuItem.Data = new MyClass();

There are two options here...

1. Create a Dictionary<Widget, T> (you pick the T according to your
needs) and use that dictionary to map widgets to the data you want to
associate with them.

2. Derive the widget classes and create a property on them for your needs.

The reason that the "user data" mechanism is marked obsolete is
because it's completely the wrong way to model something like this and
usually creates more problems than it solves.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to