Hello Marcia,
Sorry to get back to you so late.
Your code snippet is another useful way of doing what I wanted to do. Thank you so much for sharing this with me.
Pat
>Hi Pat.
>
>
I would love to display an image for each row displayed in a grid: somethinglike a red flag, a yellow flag, and a green flag that would indicate the status of the record (red=critical; yellow=warning; gree= OK).>
>Here is some sample code (from the init of the grid) that should give you an idea on how to get started. In my sample code, I am scanning through the countries table and adding an image control to the first column of the grid to hold a picture of that country's flag. Keep in mind that the column's sparse property must be set to false for this to work:
>
>
>*** Add the flag to column1
>SELECT Country
>SCAN
> IF cCountry # '<unknown>'
> THIS.Column1.AddObject( "img" + ALLTRIM( cCountry ), "Image" )
> ELSE
> THIS.Column1.AddObject( "imgUnknown", "Image" )
> ENDIF
> THIS.Column1.Controls[ THIS.Column1.ControlCount ].Picture = ALLTRIM( cIconFile )
> THIS.Column1.Controls[ THIS.Column1.ControlCount ].Stretch = 2
> THIS.Column1.Controls[ THIS.Column1.ControlCount ].BackStyle = 0
>ENDSCAN
>THIS.Column1.DynamicCurrentControl = [IIF( NOT EMPTY( Clients.cCountry ), "img" + ALLTRIM( Clients.cCountry ), "imgUnknown" )]
>