You need to use the getImageBlock of the ListView or of the ListViewColumn.
The getImageBlock gets passed the object in the list (as translated by the
getContentsBlock -- if any) and should answer the image index of the icon to
use. E.g. if you want to reuse the tick/cross icons from the Boolean class
depending on whether #age is > 18 for each list item, you could use a block
like:
[:each | (each age > 18) icon imageIndex]
(which depends on the value of (each age > 18) being an instance of Boolean
and hence having the desired icon).
A few things to watch out for:
Don't forget to answer the #imageIndex of the icon, not the icon itself.
If you want to set the getImageBlock for columns within a ListView then
you'll also have to give a dummy getImageBlock for the ListView as a
whole -- it isn't used, but unless the block is non-nil then Dolphin assumes
that you don't want images. (That is from memory, it may not be necessary
any longer).
Its a good idea to save the image before testing anything like this. If
something's wrong with your block, then you can end up with a cascade of
walkbacks which make it impossible to fix the problem. *If* that happens
(it doesn't always, by any means) then you'll be able to kill Dolphin from
the task bar without loosing work.
-- chris
"Bruno Buzzi" <
[hidden email]> wrote in message
news:917h35$3b00v$
[hidden email]...
> Hi All,
>
> How can I do to assign an icon to an individual object ?
>
> I have a ListView and I want to display an icon inside the ListView, but
> this icon depends on an attribute of the item inside the ListView.
>
> The defalult icon for all objects is
> icon
> ^self class icon
>
> I want icon for individual objects, and I do not want to add icon
attribute
> to my classes. The icon for every object (in the ListView) is assigned by
> IconManager class.
>
> Thanks Bruno.
>
>