Conditionally Color Rows

Using Clarion 10. I’ve had zero success in changing a Row’s Color, based on a variable in the Row. Is this possible? Or does it have to be done on a column by column basis.

Thank you.

Jim

In addition to using addon templates and/or classes, you could also use the wonderful world of Disney :slight_smile:

JSColorQ              QUEUE,TYPE
ColorDesc1              STRING(30)
TextColor1              LONG
BackColor1              LONG
TextSelColor1           LONG,OVER(TextColor1)
BackSelColor1           LONG,OVER(BackColor1)
ColorDesc2              STRING(30)
TextColor2              LONG
BackColor2              LONG
TextSelColor2           LONG,OVER(TextColor2)
BackSelColor2           LONG,OVER(BackColor2)
ColorDesc3              STRING(30)
TextColor3              LONG
BackColor3              LONG
TextSelColor3           LONG,OVER(TextColor3)
BackSelColor3           LONG,OVER(BackColor3)
ColorDesc4              STRING(30)
TextColor4              LONG
BackColor4              LONG
TextSelColor4           LONG,OVER(TextColor4)
BackSelColor4           LONG,OVER(BackColor4)
ColorDesc5              STRING(30)
TextColor5              LONG
BackColor5              LONG
TextSelColor5           LONG,OVER(TextColor5)
BackSelColor5           LONG,OVER(BackColor5)
ColorDesc6              STRING(30)
TextColor6              LONG
BackColor6              LONG
TextSelColor6           LONG,OVER(TextColor6)
BackSelColor6           LONG,OVER(BackColor6)
                      END

Thanks Jeff. Pardon my ignorance, but how should this be called? I tried a number of things in the SetQueueRecord Embed but not much joy.

You can conditionally change a cell colour, if you want to conditionally change a row color you would have to configure every field in the row to be conditionally colored

I have a template at A Clarion Template to Change Browse Colors which might help? It has a C10 demo app that you can play with.

Edit: The template probably won’t help since it is designed to change the entire table. Use conditional colors for every field in the table. You set that up in the table formatter - enable colors and then in Actions for the table, choose the colors tab and enter your condition for each field.

Thanks Geoff. I will grab your template anyway. I’m sure it will teach me something.

BTW: Is this a C10 issue that gets resolved in 11 or 12?

There are 2 approaches for coloring Cells. But there are no approaches that change the color of a row. This isn’t an “issue” - it’s just the way the list boxes / queues work.

The one approach is, as Jeff showed, is to set each cell to have the color option on. This allows for direct colors to be used on a cell by cell basis. If you are coloring based on a field in the row, then this is certainly an approach to go. It uses 4 LONG values per field in the queue., so you have infine control over foreground and background.

The second approach is to create “styles” for the control. Then each cell can be assigned to a style. This uses fewer fields in the Queue (1 LONG per column), but since it requires a pre-defined style, it doesn’t give the endless range the colors do. Use this approach when you have a limited palette to choose from.

A browse will generate the appropriate fields into the Queue if the column on the list box has the COLOR or STYLE property turned on (set on a column by column basis.) Then you set the values in the Browse Extension template. If you want to override the template embed into the SETQUEUERECORD method.

If you’re learning this from scratch, consider Bruce’s suggestion = Styles, these can deliver a more visually attractive result (eg: bold, italic, different font) into an individual cell that colour alone can’t achieve.

Thank you Bruce. Very helpful. It’s making sense now!