Re: [Fxruby-users] Listview control
Status: Inactive
Brought to you by:
lyle
|
From: Carl Y. <ca...@yo...> - 2003-12-15 03:06:34
|
That is exactly what I was looking for. Thanks for your prompt reply.
I'm sure I could scour all over the web but I happen to be in a real big
hurry, so I appreciate your answering the question in a little bit more
detail.
Hmm, setItemData... Working with this API reminds me a little bit of my
MFC days...
Carl
Lyle Johnson wrote:
>
> On Dec 14, 2003, at 8:42 PM, Carl Youngblood wrote:
>
>> Never mind. I guess I need to call appendItem to add to the end of
>> the list. But I'm still a little confused by setItemData. It takes
>> two parameters, index and data. What does data contain and how do I
>> set the values of multiply columns?
>
>
> You can associate with each icon list item a reference to some other
> Ruby object. Say for example that every row in the icon list
> represents a customer, which is represented elsewhere in your
> application by a Customer object. Then you can make this association
> while you're creating its icon item, e.g.
>
> theCustomer = customerDatabase.getCustomer(...)
> iconList.appendItem(theCustomer.name, bigIcon, miniIcon, theCustomer)
>
> You can change this association later using setItemData(), e.g.
>
> iconList.setItemData(itemIndex, someOtherCustomer)
>
> I'm not sure I understand the second part of your question ("... how
> do I set the values of multiple columns?"). Each icon item (i.e. each
> row in the list) can be displayed with multiple fields when the list
> is configured in details mode. Those fields are specified as the
> "text" of the icon item, and each field is separated by tabs. So for
> example, if you wanted three columns (with the name, address and
> phone number of the customer) you might do something like:
>
>
> iconList.appendItem("#{theCustomer.name}\t#{theCustomer.address}\t#{theC
> ustomer.phone}", ...)
>
> If this isn't what you were asking about, please let me know.
>
> Hope this helps,
>
> Lyle
>
>
>
|