Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting a cell colour in grid 1

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
CA
I am using the grid control that comes with VFP 6.0.
I have stored in my file (in a character field) a series of RGB() colour values.
They represent the symbol color for each record.
I would like to display these RGB colors in my grid.
I have a column called color and I would like each row to display the RGB
colour for that row as stored in my file.

Any suggestions on how I can do this?

Thanks

Linda
 
Hi Linda,

Try something like:

gridx.setall('dynamicbackcolor', &colorfield, 'column')

Jim
 
Hi Linda
You have to put the code in the

MyGrid.InitEvent
================
WITH THIS
.SetAll("DynamicBackColor","EVAL(ColorField)","COLUMN")
ENDWITH
This will work for you...
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Thanks for your response. I got it to work with one small variation
I just needed to and the & in front of the field name:

*code placed in init event of the grid and this will set the color for all columns
colorfield="TMP_DATA.COLOR"
WITH THIS
.SetAll("DynamicBackColor","EVAL(&ColorField)","COLUMN")
ENDWITH

*alternatively this code in the init event of the grid will set the color of a specific column
lcdynamicbackcolor="This.column6.dynamicbackcolor"
&lcdynamicbackcolor="EVAL(&ColorField)"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top