Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Specifying color in a config table
Message
 
 
To
21/08/2019 09:31:13
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01670193
Message ID:
01670204
Views:
54
>>Hi,
>>
>>All grids of my app are built from configuration tables (.DBF tables). That is, using data-driven approach.
>>I decided to add a backcolor specification for various columns. I can do it one of two ways:
>>1. Add a field BACK_COLOR to the configuration DBF and enter a number there (at design time). For example, for the color 128,255,255, the value would be 16777088 (using RGB() function at design time)
>>2. Add fields BC_RED, BC_GREEN, RD_BLUE and enter the values for each color (e.g. 128, 255, 255) and then the application code will set the grid back color using RGB() function at run time
>>
>>Which of the above is a better practice, in your opinion?
>
>Since you're building your grids programmatically, from this table, the difference at runtime is negligible, you're doing it once per column - just a simple assignment to a property. Whether it be .backcolor=metagrd.back_color, or .backcolor=rgb(bc_red, bc_green, bc_blue) is irrelevant, you're wasting less than millisecond more with the later approach.
>
>I'd still prefer the first approach - as we mostly deal with vfp's (wrong-endian) color numbers, not individual rgb components. With rgb components, at design time you have to split the value to store it, then put it together at runtime, and I see no gain in doing so.

Thank you so much for your input. I will probably follow your suggestion (unless someone gives me a compelling reason otherwise). The only reason, I thought, for using a separate number in the configuration file is that it would be "easier" to guess the actual color by looking at the number. Instead of looking at the total number derived from the RGB() function.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform