Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing colors in individuals cells on a grid
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00319234
Message ID:
00319239
Vues:
17
>Does anyone know how to change the BackColor and ForeColor for an individual cell in a grid without having it affect the entire column? We are trying to give our users a visual clue that they have changed the values with a cell.
>
>Any help would be appreciated.
>
>Bryan Jackson
>for Rudy Nieves

Bryan,
Funny you should ask. I just spent a week working this one out. The answer is very simple. In the DynamicBackColor of the column you can put a function to set the color as you wish.

Most examples show something like :
Thisform.grdMyGrid.Column1.DynamicBackColor = ;
"iif(, rgb(255,255,255), rgb(255,0,0)"
being put in the init of the form or grid
(this turns the back color to red if not true, otherwise it is white)
You must put quotes around the function.

But I found that you can simply put:
iif(, rgb(255,255,255), rgb(255,0,0)
directly in the column DynamicBackColor property. Although the area to type in is small you can put a lot in there. Just let it scroll as needed.

If you want to use more than one color you can call a custom method.
In Column1.DynamicBackColor property put thisform.colorset()
You don't need the quotes when you put it directly into the column property!
Then in the method put:
* ---------------------------------------------------------
do case
case dayslate <= 30
mretval = rgb(0,255,0) && green
case dayslate > 90
mretval = rgb(255,0,0) && red
case dayslate > 60
mretval = rgb(0,0,255) && blue
endcase
*
RETURN mretval
* ---------------------------------------------------------
You can get the color codes by clicking on the backcolor property to bring up the color picker, choosing a color and then recording whatever got put into the property. ForeColor works the same way as does the other Dynamic whatevers.

Hope this helps.
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform