1. Steffen Chrobok
  2. PowerBuilder
  3. Wednesday, 26 April 2023 07:28 AM UTC
How can I change the background color of a data window header that is on a tab page in a theme?
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 26 April 2023 12:48 PM UTC
  2. PowerBuilder
  3. # 1

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:

  1. Name it with dot notation ("w_main.tab_1.tabpage_1.dw_1":)
  2. Specify how controls of a specific type should be affected in a specific window ("w_main$datawindow":)
  3. Specify how controls of a specific type should be affected in a specific user object ("uo_1$datawindow":)

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.

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 26 April 2023 12:14 PM UTC
  2. PowerBuilder
  3. # 2

How many windows do you have that have tab controls and contain datawindows?

Andreas.

Comment
  1. Steffen Chrobok
  2. Wednesday, 26 April 2023 12:24 PM UTC
I have almost 750 windows and about half have several tab pages with data windows on them. That's why I'm asking for a general solution with the themes, since it's far too expensive to adjust all of them individually in the Painter
  1. Helpful
There are no comments made yet.
Steffen Chrobok Accepted Answer Pending Moderation
  1. Wednesday, 26 April 2023 10:55 AM UTC
  2. PowerBuilder
  3. # 3
Thank you for your helpfulness. As I said, I want all Datawindow headers to be in a specific  color on all Pabpages. For example grey.
Attachments (1)
Comment
  1. Andreas Mykonios
  2. Wednesday, 26 April 2023 11:35 AM UTC
What is the exact version of Powerbuilder you are using? The json file is from PB 2019, but themes where introduced in 2019 and enhanced later.

Andreas.
  1. Helpful
  1. Steffen Chrobok
  2. Wednesday, 26 April 2023 11:43 AM UTC
Im using PB 2022 Build 1900.

Does the version information in the json have any influence?

I never changed it.
  1. Helpful
  1. Andreas Mykonios
  2. Wednesday, 26 April 2023 12:10 PM UTC
Of course. It PB 2022 you should use themes that came with that version of PB.

Andreas.
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 26 April 2023 08:41 AM UTC
  2. PowerBuilder
  3. # 4

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.

Comment
  1. Steffen Chrobok
  2. Wednesday, 26 April 2023 09:53 AM UTC
  1. Helpful
  1. Steffen Chrobok
  2. Wednesday, 26 April 2023 09:56 AM UTC
If I can't use any other structure, where should the dot notation go if I want to change the background of all headers of all data windows on all tab pages?
  1. Helpful
  1. Andreas Mykonios
  2. Wednesday, 26 April 2023 10:36 AM UTC
You can add customization for your specific objects. But you should not remove anything from the original json file. You can remove only parts you created. If you have some specific changes in mind send your json (or theme file you want to use) and tell us what changes you need.

Andreas.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.