How can I change the background color of a data window header that is on a tab page in a theme?
How can I change the background color of a data window header that is on a tab page in a theme?
I don't believe that themes could help you.
First of all themes cannot apply to controls that were dynamically created. This means that if you are using opentab or openuserobject, themes are not a solution.
In case you aren't using opentab or openuserobject, you would have to create a custom json file and describe somehow which windows (or userobjects) should be affected by these json file. Such a file (in my case theme-0001.json) would look like:
{
"meta-info":
{
"version":"22.0.0.1900"
},
"w_main$commandbutton":
{
"drawing":true,
"normal-state":
{
"border-color":"#B3D7F3",
"background-color":"#AAAAAA",
"text-font":{"color":"#000000"}
},
"hover-state":
{
"border-color":"#3393DF",
"background-color":"#3393DF",
"text-font":{"color":"#FFFFFF"}
},
"pressed-state":
{
"border-color":"#0060AC",
"background-color":"#0060AC",
"text-font":{"color":"#FFFFFF"}
},
"focused-state":
{
"border-color":"#0078D7",
"background-color":"#0078D7",
"text-font":{"color":"#FFFFFF"}
},
"default-state":
{
"border-color":"#0078D7",
"background-color":"#0078D7",
"text-font":{"color":"#FFFFFF"}
},
"disabled-state":
{
"border-color":"#CCCCCC",
"background-color":"#CCCCCC",
"text-font":{"color":"#999999"}
}
},
"w_main.tab_1.tabpage_1.dw_1":
{
"drawing":true,
"background-color-enabled":true,
"background-color":"#FFFFFF",
"normal-state":
{
"border-color":"#CCCCCC"
},
[...]
"dwo-compute":
{
"border":2,
"border-color":"#CCCCCC",
"background-color":"#FFFFFF",
"text-font":{"color":"#000000"}
}
}
}
}
What is interesting is how you can define what that theme will affect. You can do it by:
From information you provided until now I conclude that you would have to go using method 1, which means you would have to know the "dot notation" path to your controls. Seems to be some work.
Even if you do that, the json file for let say 250 objects could be quite large (if this is the case I'm not sure how performance would be affected).
The advantage: you could easily change the appearance when needed without having to compile you application, simply by modifying your theme.
Andreas.
How many windows do you have that have tab controls and contain datawindows?
Andreas.
Hi.
What version of PB are you using?
Generally speaking, in PB 2022, you can use dot notation. Something like:
"<your window>.<your tab>.<your tabpage>.<your datawindow>":
{
... // Copy "datawindow" node from json and make your changes.
}
I haven't tested but it should be something like that.
Andreas.