Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why does this work?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00260752
Message ID:
00260961
Vues:
12
>I put this code in the click event of a textbox in a column in a grid. I was looking for an easy way to highlight the entire row when this textbox was clicked. This code works but I don't understand why. I actually typed it, read it, processed it, and almost deleted it offhand just because it looked so wrong. It bothers me more that I don't understand why it works than if I had never come up with a solution in the first place.
>
>Here is the code:
>
>This.Parent.Parent.SetAll("DynamicBackColor", "IIF(This.Parent.Parent.ActiveRow <> This.Parent.Parent.ActiveRow,RGB(255,255,255), RGB(0,255,0))","Column")
>
>Thisform.refresh()
>
>Anybody have any ideas? Looks to me like the activerow would always be equal to itself but that's not how it works.
>
>Thanks,
>ken




Ken, something you make clear!

You need to set the DynamicBackColor for One Time only!

* i.e. at Grid.init()

This.SetAll("DynamicBackColor", "IIF(ThisForm.curRecNo<>RECNO(),256^3-1,RGB(0,255,0))","Column")

RECNO() is the Current Record Number,
Add a new property to Form to carry the current record

* at Grid.AfterRowColChange

ThisForm.curRecNo = RECNO()




I need to mention a point:

There should be NO SPACE for assigning that property!

Thisform.grid1.column1.DynamicBackColor = "RGB(255,0,0) " && don't work!

Thisform.grid1.column1.DynamicBackColor = "RGB(255,0,0)" && work!


~_^
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform