1. Tomas Beran
  2. PowerBuilder
  3. Thursday, 5 January 2023 10:40 AM UTC

Hi

Is there a way how to force a different button color from code if a theme is applied?

 

The only working method I've found is to disable theme for the button with

"drawing":false

But what I want is to use the theme and only override it programmatically in special cases.

Tomas Beran Accepted Answer Pending Moderation
  1. Wednesday, 15 February 2023 14:18 PM UTC
  2. PowerBuilder
  3. # 1

Is there a datawindow color magic number for theme background and foreground?

Like there's 553648127 for transparency and 1073741824 for Window Background?

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 5 January 2023 23:00 PM UTC
  2. PowerBuilder
  3. # 2

If all else fails, then create a new button on the window with the appropriate colors set and hide it with a taborder of zero.

When you need it, take the current button, set the taborder to zero, and hide this button. Then take the OTHER button - the one with the color you want - set the taborder to the correct taborder of the button, set the X and Y coordinates to that of the original button, and SHOW the button.

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 5 January 2023 16:46 PM UTC
  2. PowerBuilder
  3. # 3

How about setting a different color button for a particular button through the theme?  UI Themes support making exceptions to apply a different theme to a particular instance of an object rather than global.  Please refer to the "Custom theme definition files for selected objects or controls" section in this tech article: https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/301-applying-a-new-ui-theme-to-your-application-2

Comment
  1. Tomas Beran
  2. Thursday, 5 January 2023 17:03 PM UTC
Showing / hiding buttons is one of the ways I was thinking about.

Another option is:

- disable button theme

- take the button color from currently used theme and set buttons in window open event

- apply the color-changing business logic.
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 5 January 2023 13:07 PM UTC
  2. PowerBuilder
  3. # 4

Hi Tomas.

In this specific case inheritance won't help.

I don't believe that you can change dw button's background color when a theme is set. Neither setting an expression with modify or in dw painter will work unless you are not using a theme.

Andreas.

Comment
There are no comments made yet.
Tomas Beran Accepted Answer Pending Moderation
  1. Thursday, 5 January 2023 12:06 PM UTC
  2. PowerBuilder
  3. # 5

Hi Andreas

What is the exact version of PB you are using?

- PB2021 and PB2022. I tried both and the result was always same. So I think this is intentional.

 

What are those cases?

- Anything where you need a user's focus at the button. Like:

  There are new records or events touching this topic

  There are new replies to this thread

  The time is Over (at button 'Done' in a tasklist)

 

Maybe you could achieve what you want with inheritance and custom themes...

- I'm not sure I understand you. The idea is: The button has to be red if some conditions based on the business logic are met. Otherwise the theme color is used.

- I've observed that for columns the theme is applied only at the creation point. So I can easily modify background.color. For buttons this is not possible (or I haven't found how to do it).

- Of course it would be nice to have classes for datawindow objects like CSS class in HTML and power to change the class with "modify" or datawindow expressions. But this is not there at this time.

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 5 January 2023 10:54 AM UTC
  2. PowerBuilder
  3. # 6

Hi.

What is the exact version of PB you are using?

What are those cases? Maybe you could achieve what you want with inheritance and custom themes...

Andreas.

Comment
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.