Andrew Price
2020-08-04T15:04:39Z
I use e.imageindex within CellDynamicContents to set an image of a cross 'X', or image of a tick within a cell based on the content of the underlying data

I want to look down the grid and find all items with a cross image, or all items with a tick image, depending on what searching I am performing.

The routine which searches the grid for cross or tick is in a separate class, so does not know the rules applied by the calling application for it to place a tick or cross image in the cell.

I loop through the cells looking at .cells(row,col).imageindex in order to see if that belongs to the index for a cross or the index for a tick from the grids imagelist.

However, my loop .cells(row,col).imageindex always returns -1

I can only assume that setting the imageindex within CellDynamicContents does not actually store the image index in .cells(row,col).imageindex

How do I check what image is in a cell having displayed it using CellDynamicContents, or should I be setting this image elsewhere?

Thanks
Sergiy/10Tec
2020-08-05T03:55:09Z
If you want to use cells(row,col).imageindex, you need to set it by yourself when you load data.
CellDynamicContents doesn't set imageindex prop of the cell. Event is called each time
cell is painted on the screen and doesn't change underlying grid data.

Other solution would be to call code from your CellDynamicContents implementation
in order to get image index for the cell and do not use cells(row,col).imageindex.