PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → Programming the colors in a table
Programming the colors in a table
Started by Volker Gericke, Aug., 10 2025 1:59 PM - 2 replies
Posted on August, 10 2025 - 1:59 PM
Hello,

Every table contains several colors depnding on the state of the row.
We have rows with odd line numbers, rows with even line numbers and we have a selected row (or selected rows).
It is rather easy to modify these colors using the table description.

But when I try to program this myself, I encounter difficulties as I only have two variables: Color (for the font) and Backgroundcolor (for the background).

Can anyone tell me how I can program the colors of the rows specifically?

Thank you and kind regards,

Volker
Registered member
127 messages
Posted on August, 13 2025 - 10:03 AM
In the Event "Displaying a row of the Table control" of your Table-Control use something like this:

//Your decission, what kind of backgroend is to use (here for ex. a simple modulo calculation)
SWITCH Modulo(MySelf,4)
CASE 0
MySelf[MySelf]..BackgroundColor = LightBlue
CASE 1
MySelf[MySelf]..BackgroundColor = LightGreen
CASE 2
MySelf[MySelf]..BackgroundColor = LightRed
CASE 3
MySelf[MySelf]..BackgroundColor = LightYellow

OTHER CASE
//Nothing
END
Posted on August, 13 2025 - 10:30 AM
meikl wrote:
In the Event "Displaying a row of the Table control" of your Table-Control use something like this:

//Your decission, what kind of backgroend is to use (here for ex. a simple modulo calculation)
SWITCH Modulo(MySelf,4)
CASE 0
MySelf[MySelf]..BackgroundColor = LightBlue
CASE 1
MySelf[MySelf]..BackgroundColor = LightGreen
CASE 2
MySelf[MySelf]..BackgroundColor = LightRed
CASE 3
MySelf[MySelf]..BackgroundColor = LightYellow

OTHER CASE
//Nothing
END


Thank you Meikl,

That works fine and helps a lot.
Is there also a way to control the selected bar?

Kind greetings,

Volker