Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Grid HighlightBackColor dynamically
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01253689
Message ID:
01253694
Views:
21
>I've got a grid which has AllowCellSelection set to .F., HiglightStyle set to 2, and I set the DynamicBackColor to change between white and green depending on whether a date is filled in in a field of the current record that the grid is bound to. This works OK.
>
>The only problem with the above is that if I've set a record to the green background you can't tell when that record has focus (it's set to the HighlightBackColor). I've tried adding code to the AfterRowColChange event to change this dynamically, but it seems to only work the very first time (and then it's "stuck" on that color, so every record I select uses that same color). I've run into this in the past and I've ended up doing things like shutting off AllowCellSelection and using the "old style" grid highlight bar techniques. That kind of sucks so I was hoping someone had an easy way to work around this besides what I've been doing.

Try this (I didn't :o))
*** Set the DynamicBackColor
thisform.Grid1.SetAll([DynamicBackColor],[thisform.SetGridColor()],[Column])


*** In the method SetGridColor
LOCAL lnDynamicColor, lnHighLightColor
DO CASE
   CASE Condition1
        lnDynamicColor   = RGB(a)
        lnHighLightColor = RGB(b)

   CASE Condition2
        lnDynamicColor   = RGB(c)
        lnHighLightColor = RGB(d)

   CASE Condition3
        lnDynamicColor   = RGB(e)
        lnHighLightColor = RGB(f)

OTHERWISE
        lnDynamicColor   = default color here
        lnHighLightColor = default hightlight color here
ENDCASE
thisform.Grid1.HighLightColor = lnHighLightColor
RETURN lnDynamicColor
Where a,b,c,d,e,f are color values.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform