How to Change List(Browse) header background color on a manifested program

How to set header and group header properties of a list box at runtimeExample.zip (43.0 KB)

2 Likes

The Point of the example is to set the column header background color when you have a manifest that includes common controls.

The header background colors are lost, unless you use the undocumented PROPLIST:DefHdrBackColor

In the example @Bruce posted above,
The interesting code can be found in BrowseClient behind Button1
Below are some of the lines of code behind that button

 !! This line is required if you want to change background colors at runtime.
 ?Browse:1{PROPLIST:DefHdrBackColor,1} = color:red

 ?Browse:1{PROPLIST:HdrBackColor,3} = color:silver

 ?Browse:1{PROPLIST:HdrBackColor + proplist:group,5} = color:silver

Note the ,1 above is not needed, just use the following
In any case, this line is important the other commands will not work without it.

  ?Browse:1{PROPLIST:DefHdrBackColor} = color:red
1 Like

Also if you’re declaring header background colors in the format statement of the window
you can get them appear by using

?Browse:1{PROP:NoTheme} = TRUE

However testing shows I couldn’t set it as the result of a button click
But it did work when I set it between opening the window, and before the Accept loop

Curiously PROP:NoTheme is documented as only applying to Sheets and Tabs

2 Likes

only RED color is allowed? :joy:

Mark,

I have a similar issue, however it is a queue list. I can set greenbar colors but have been unsuccessful in setting the header color in the list. I’ve tried your suggested code without results. Here is what I’m adding at the end of my greenbar routine

?ApparatusMenuList{PROPLIST:DefHdrBackColor} = color:gray
?ApparatusMenuList{PROPLIST:HdrBackColor} = color:gray

The queue has 1 column that is grouped with 3 fields. I also tried added this line without any results.

?ApparatusMenuList{PROPLIST:HdrBackColor + proplist:group} = color:gray

Is it even possible to set the header color in a queued list box?

Mark,
Just to follow-up I discovered I had the code in the wrong embed point. Your solution worked fine. Thanks for the solution!

This post came up in the 10/28/2020 Open Webinar…

To have a Background LIST color the Prop:NoTheme=True is only required if you are using Visual Styles “VS” and running Windows 10. I mention in case you are not having a problem its probably because you are not using VS. You would be best to set NoTheme=1 in your code incase someday you turn on VS.

If you are previewing a Window and have VS On in Designer then you will not see your background color. You can’t set NoTheme on the LIST in Designer but you can turn off VS to see your colors.

The example above sets Header text colors only on Groups. In an APP if you set Header Text color for a Data column the Format() is HT(color) and the Templates confuse it for a Tree T() and generate a LONG into the Browse Queue.

The workaround for an APP is to assign the color at runtime ?List{PROPLIST:HdrTextColor,Column#}=Color.

Here is a capture showing the HT causing Data1_Level LONG to be generated.

1 Like

My Window Previewer class in GitHub will show the color PROPs and the Resizer and Reformater can change them.

1 Like