Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To: Display an Icon is a grid row
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00752161
Message ID:
00752629
Views:
25
This message has been marked as the solution to the initial question of the thread.
Hello Bhavbhuti.

I have a grid for a view. This view has a column containing the name of the bitmap file. I have replaced the default text box of the grid with an image control with picture: =(v_sPatients.cIcon) but I cannot get the column in the grid to display the icon.

You need code similar to this in the init of the grid:
DODEFAULT()
*** Add the image to column1
SELECT v_sPatients
SCAN
  IF NOT EMPTY( cIcon ) 
    THIS.colCustom1.AddObject( "img" + ALLTRIM( cIcon ), "Image" )
  ELSE
    THIS.colCustom1.AddObject( "imgUnknown", "Image" )
  ENDIF    
  THIS.colCustom1.Controls[ THIS.colCustom1.ControlCount ].Picture = ALLTRIM( cIcon ) + '.bmp'
  THIS.colCustom1.Controls[ THIS.colCustom1.ControlCount ].Stretch = 2
  THIS.colCustom1.Controls[ THIS.colCustom1.ControlCount ].BackStyle = 0
ENDSCAN
THIS.colCustom1.DynamicCurrentControl = [IIF( NOT EMPTY( v_sPatients.cIcon ), "img" + ALLTRIM( v_sPatients.cIcon ), "imgUnknown" )]
In order for DynamicCurrentControl to work, you must set the column's Sparse property to False.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform