>>>>>>Hi everybody,
>>>>>>
>>>>>>I implemented GridHighlighter in several applications, all work fine, but I have one problem, which I'm not sure, how to resolve. For some forms in addition to highlighting record I want to show records in different backcolor (or forecolor, doesn't matter), depending on some condition. For instance, I have Status field, which can have 3 different values. For value one I want one color, for value two - another and value three - default color. I implemented my code in onPostSetDynamicColor method as showed in Nick's sample form (mycolor.prg). But I could not figure out, how to preserve record highlighting for the current record. IOW, myColor program should be changed somehow, but I don't know, how. Could somebody advise me here?
>>>>>>
>>>>>>Thanks in advance.
>>>>>
>>>>>Nadya, could you clarify?
>>>>>
>>>>>The scenario:
>>>>>Value 2 (backcolor red) is the current field value in the highlighted record. Highlight backcolor is blue. If focus is not on this cell, the cell will show as red.
>>>>>1. When the focus is on this cell, do you want this field to show as red or blue ?
>>>>Blue
>>>>
>>>>>2. When the focus is NOT on this cell, do you want this field to show as red or blue ?
>>>>Blue
>>>>
>>>>How can I do that?
>>>>
>>>>Thanks in advance.
>>>
>>>1. Already is the default feature of Grid Highlighter
>>>
>>>2.
>>>
>>>*** OnPostSetDynamicColor()
>>>LOCAL lcHost
>>>lcHost = THIS.chostname
>>>************** This line calls the function which returns the corresponding color
>>>THIS.PARENT.&lcHost..Column1.DYNAMICBACKCOLOR = "my_color(employee.employee_i, this.parent.GridhighLighter1.nRecno, this.parent.GridhighLighter1.cHighBackColor)"
>>>
>>>*** updated MY_COLOR.PRG from the previous sample
>>>LPARAMETER tcValue, tnRecno, tcRecordHighLightColor
>>>tcValue = ALLTRIM(tcValue)
>>>LOCAL lnColor
>>>DO CASE
>>> CASE tcValue = "4"
>>> lnColor = RGB(255,0,0)
>>> CASE tcValue = "5"
>>> lnColor = RGB(0,255,0)
>>> CASE tcValue = "6"
>>> lnColor = RGB(0,0,255)
>>> CASE tcValue = "7"
>>> lnColor = RGB(255,255,0)
>>> OTHERWISE
>>> lnColor = RGB(255,255,255)
>>>ENDCASE
>>>RETURN IIF(tnRecno = recno(), EVAL(tcRecordHighLightColor), lnColor)
>>>***
>>>
>>
>>I'll try on Monday at work. I tried to connect through PCAnywhere, but I can't and I don't have my latest version at home.
>>
>>BTW, what is the property for ForeColor? cHighForeCOlor?
>
>Yes.
Nick,
I just tried this code with your sample form and I got invalid DynamicBackColor message. What's wrong? I used the sample for, which comes with GH, and just copied and pasted this program and expression.
If it's not broken, fix it until it is.
My Blog