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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid and checkbox 1

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
US
I have a checkbox as one of the columns in my grid. It is bound to a logical field. In the check1.click event I have:

IF table1.check1 = .t.
Thisform.grid1.column2.ForeColor =255
Thisform.grid1.column3.ForeColor =255
Thisform.grid1.column4.ForeColor =255
ENDIF

This changes the color for all the records in the grid. I only want to change the color for the row in which the checkbox is checked. May be 'active row' property ?
 
For row dependent coloring you'll need to use the DynamicBackColor property. Use the Keyword Search tab above on DynamicBackColor, and you'll get lots of threads with further discussions and examples.

Rick
 
shangrilla

The problem is you have to check each records and use the DynamicBackColor as Rick suggests. Try these steps:

[ol][li]In the Init of the grid put:
this.column1.DynamicBackColor="thisform.colorcheck()"[/li]
[li]Create a method called colorcheck in your form [/li]
[li]In the method put:
IF myTable.logic
thecolor = 255
ELSE
thecolor = 0
ENDIF
RETURN thecolor
[/ol]

This will make the records Red for selected checkbox or black for unselected.

Mike Gagnon
 
something like list, in the from init event

ThisForm.Grid1.SetAll("DynamicBackColor",;
"IIF(mytable.field, RGB(255,0,0), ;
RGB(255,255,255))", "Column")

mytable.field is the logicl field, if true
the row will become red, false white.

Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top