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

Grid Color/Font Bold:

Status
Not open for further replies.

FoxLearner

Programmer
Aug 29, 2002
93
US
Hi All
I have a grid showing different plans for a customer. Only one of them is Current Plan. My users requested me show the row which shows the current plan to be of Different color or shown in Bold Font.
Can anyone tell me how to do it please?
FoxLearner
 
Hi

myGrid.InitEVENT
**************************************************
DODEFAULT()
WITH THIS
.SetAll("DynamicBackColor", ;
"IIF(myField = myCurrentPlan, ;
,RGB(32,224,224),RGB(255,255,192))","COLUMN")
ENDWITH
**************************************************

Suitably put myField and the variable name holder for the myCurrentPlan.


:)


____________________________________________
Ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Ramani
I used your code. Here is how I used it.
***************
LOCAL lnRowNum
SELECT curRatings
SET DELETED ON
GO TOP
LOCATE FOR isCurrent = .T.
lnRowNum = RECNO()
WITH THIS
.SetAll("DynamicBackColor",IIF(RECNO() = lnRowNum,[RGB(223,225,138)],[RGB(255,255,192)]),"COLUMN")
ENDWITH
*************

But it is changing the color for all the rows. There is only one row where isCurrent = .T.
Can you please tell me what might be wrong here?
 
FoxLearner,
I think you're making things more complicated than you need to.

You just need:
&&&&&&
thisform.grid1.SetAll("DynamicBackColor",;
"IIF(isCurrent = .T.,;
RGB(223,225,138),RGB(255,255,192))","COLUMN")

thisform.grid1.refresh
&&&&&&

Also, you can use a ?GETCOLOR() to figure out how to tell VFP what color you want. r.g. RGB(255,255,192) and 12648447 are the same thing as far as VFP is concerned.

Brian
 
Brian
I did that before I used this code. But for some reason it didn't work. I found some thing in the Knowledge base saying that if the grid contains a field where the sparse property is set to .F., it raises errors for DynamicBackColor/ForeColor/Font.. properties.
I used IIF(isCurrent = .T.,..) in the DynamicBackColor properties window of the grid, and it is working fine. I don't know the reason, but for now, I could solve the problem, may not be the best way.
Thanks for you support
FoxLearner
 
I guess the next question is why you need to have the sparse property is set to .F., and if there's a different way to achive the same result.

Moving the pointer can get messy, especially if you're updating the highlight in more than just the init event.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top