8/01/2012

Changing Label Colors (ZP SQL & ZP 32)

I have written before about how to use a script to change the text assigned to a field label. Today I had a customer ask if you could also change the color of the label to make it stand out. In this example I'm selecting "Base" as the Module, "Property" as the Screen, and "Screen" as the Action and my script is:


propscreen.zp_pageframe1.page1.lblExist_use.Caption = "Warning"
propscreen.zp_pageframe1.page1.lblExist_use.Forecolor = RGB(255,0,0)

The first line changes the label for the Existing Use field on the Property Screen to "Warning." The second line makes that label red. To change the color of a field you enter in three Red/Green/Blue values from 0 to 255. Different values produce the rainbow of colors. You can use a number of web sites to learn the RGB values for any color you desire.