Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing Grid HighlightBackColor dynamically
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01253689
Message ID:
01253721
Vues:
26
>>>
>>>Try this (I didn't :o))
>>
>>Unfortunately, no, it doesn't work.
>
>That works for me:

When I tried it, it appeared to work. But then as I started adding more records to my test it appeared to be evaluating a different record than the current one.

Try this code and notice that it doesn't work correctly:
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"
        AllowCellSelection = .F.


    PROCEDURE Load
        CREATE CURSOR crsTest (Fld1 int, Fld2 C(20))
        
        INSERT INTO crsTest VALUES (1, "1")
        INSERT INTO crsTest VALUES (1, "1")
        INSERT INTO crsTest VALUES (2, "2")
        INSERT INTO crsTest VALUES (2, "2")
        INSERT INTO crsTest VALUES (2, "2")
        INSERT INTO crsTest VALUES (3, "3")
        INSERT INTO crsTest VALUES (3, "3")                                        

        GO TOP
    ENDPROC


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


    PROCEDURE setgridcolor
        LOCAL lnDynColor, lnHghLghtColor
        
        IF Fld1 = 2
           lnDynColor = RGB(183, 255, 124)
           lnHghLghtColor = RGB(183, 255, 124)
        ELSE
           lnDynColor = RGB(255, 255, 255)
           lnHghLghtColor = RGB(236, 233, 218)
        ENDIF
        thisform.Grid1.HighlightBackColor = lnHghLghtColor
        RETURN lnDynColor
    ENDPROC


ENDDEFINE
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform