[fxruby-users] associating objects with FXTable rows

Mark Volkmann r.mark.volkmann at gmail.com
Sun Apr 2 08:30:23 EDT 2006

On 4/1/06, Scott Willson <scott at butlerpress.com> wrote:
> On Apr 1, 2006, at 8:11 PM, Mark Volkmann wrote:
> > I'd like to associate an arbitrary object with a row in an FXTable. I
> > thought I could do it using FXTableItems for my cells, but that
> > doesn't work. Here is basically what I tried.
> >
> > item = FXTableItem.new(string_value, nil, some_object)
> > table.setItem(row, column, item)
> >
> > some_object is an object from my ToDo class.
> > This fails on the first line with "in `initialize': wrong argument
> > type ToDo (expected Data)".
> > Apparently I can't pass an arbitrary object as the last parameter of
> > the FXTableItem constructor. What does it expect?
> Try something like this:
> FXTableItem.new(string_value, nil) { |item|
>    item.data = some_object
> }

Wow!  That works!  But does it make sense? I would have thought your
code and mine would do exactly the same thing. Why can I assign to
"data" after I've created the FXTableItem object, but I can't pass the
same value to the FXTableItem constructor?

R. Mark Volkmann
Object Computing, Inc.

More information about the fxruby-users mailing list