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:
01253702
Views:
21
>>
>>Try this (I didn't :o))
>
>Unfortunately, no, it doesn't work.

That works for me:
oForm = CREATEOBJECT([form1])
oForm.Show(1)

DEFINE CLASS form1 AS form


    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"


    ADD OBJECT grid1 AS grid WITH ;
        Height = 200, ;
        Left = 12, ;
        Top = 8, ;
        Width = 320, ;
        HighlightStyle = 2, ;
        Name = "Grid1"


    PROCEDURE Load
        CREATE CURSOR crsTest (Fld1 int, Fld2 C(20))
        FOR asd = 1 TO 20
            INSERT INTO crsTest VALUES (asd, REPLICATE([A],asd))
        NEXT
        GO TOP
    ENDPROC


    PROCEDURE Init
        thisform.Grid1.SetAll([DynamicBackColor],[thisform.SetGridColor()],[Column])
    ENDPROC


    PROCEDURE setgridcolor
        LOCAL lnDynColor, lnHghLghtColor

        DO CASE
           CASE Fld1 = 1
                lnDynColor     = RGB(255,0,0)
                lnHghLghtColor = RGB(0,0,255)
           CASE Fld1 = 2
                lnDynColor     = RGB(0,255,0)
                lnHghLghtColor = RGB(255,0,0)
           CASE Fld1%2 == 0
                lnDynColor     = RGB(0,0,255)
                lnHghLghtColor = RGB(0,255,0)
        OTHERWISE
                lnDynColor     = RGB(255,255,255)
                lnHghLghtColor = RGB(255,255,0)
        ENDCASE
        thisform.Grid1.HighlightBackColor = lnHghLghtColor
        RETURN lnDynColor
    ENDPROC


ENDDEFINE
not the best chosen colors but you'll see that every even row is green highlighted, first row has blue highlight, record 2 has red highlight and all odd rows after 2 are yellow highlighted.
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