Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I display images in a grid?
Message
From
31/01/2004 17:34:53
 
 
To
31/01/2004 13:48:08
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00872676
Message ID:
00872709
Views:
14
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" )]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform