1. Glenn Barber
  2. PowerBuilder
  3. Tuesday, 20 December 2022 00:00 AM UTC

We have a pfc based app and want to dynamically change the MDI window's title background color (not the background of the windows which we can already change using mdi_1.backcolor)

It seems that windows assets a color based on the user's desktop preferences - but we would like to override in specific cases.

What is the specific property for the title background color and can it be overridden?


FWIW - I found some same C# Code for accessing these properties 


var titleBar = m_AppWindow.TitleBar;

// Set active window colors

titleBar.ForegroundColor = Colors.White;

titleBar.BackgroundColor = Colors.Green;

// Set inactive window colors

titleBar.InactiveForegroundColor = Colors.Gainsboro;

titleBar.InactiveBackgroundColor = Colors.SeaGreen;



John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 20 December 2022 01:23 AM UTC
  2. PowerBuilder
  3. # 1

Hi, Glenn -

May I assume you are NOT using PB Themes?

If not, then you are correct that a window's title bar (called the window's "caption") is drawn by the Windows operating system, not PB. Because of this, it is not possible for a PB app to customize the colors used to draw the captions of active and inactive windows. Prior to Windows 10, these and other "system" colors could be set by an application, but doing so affects ALL windows, not just one, so that is not considered a viable solution.

You did not go into any details as to why you are wanting to do this, but for your information, however, it is possible to utilize a Windows API function to temporarily "flash" a window's title bar and/or taskbar icon. If you are interested in pursuing this avenue, I can provide you with some details.

Best regards, John

There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 20 December 2022 19:16 PM UTC
  2. PowerBuilder
  3. # 2

Here's a possible alternative solution: When needed, open a small child window, the only purpose of which is to indicate whatever version/status/etc. that needs to be displayed. Here's an example I threw together:

If you disable resizing, Min/Max buttons and the control menu (as shown above), but enable the title bar, the child window can be moved around by the user as needed, but not closed. The child window remains on top of any/all sheet windows, and the child windows moves with the frame window when it is moved. While it IS possible to "hide" the child window by shrinking the size of the frame, a little code in the frame window's Resize event can recognize when this occurs and reposition the child window automatically.

If you pass a structure in to the child window via Message.PowerObjectParm, the child window could customize itself with the window title text, the text displayed in the window, the background color, its size and/or position, etc. for different environments/purposes.

The child window closes automatically when the frame window is closed.

HTH, John

There are no comments made yet.
Glenn Barber Accepted Answer Pending Moderation
  1. Tuesday, 20 December 2022 01:34 AM UTC
  2. PowerBuilder
  3. # 3

No - not using themes - we've been using the MDI background color to dynamically distinguish apps being tested in a QA environment to avoid being confused with production - but this disappears when a MDI window overlays the entire mdi frame - so we were looking to update the MDI wndows titlebar background color.

Note I added the C# properties and some sample code I found.  Not sure I understand why I can't override this post open?

  1. John Fauss
  2. Tuesday, 20 December 2022 02:47 AM UTC
I really cannot speak to C#, but if I had to guess, I surmise it is because the C# "window" class provides access properties/methods to do this. In C++ (which is what PB is under the covers), this capability may not exist without either subclassing Window's base window class or utilizing owner-drawn windows, neither of which PB supports. What it basically boils down to is: PB has Windows draw the window's frame (border), title bar, control menu, etc. in a very simple, basic way and does not provide a means to control these properties.

If you are using the PFC, are you using the PFC's "status bar window" (w_statusbar in pfewnsrv.pbl) that displays in the lower-right corner of the frame over the end of the MicroHelp? I've worked on apps in the past where this was used for various purposes. This status area is customizable, so you should be able to change its background color, for example. As Chris is fond of saying, "food for thought".
  1. Helpful
  1. Glenn Barber
  2. Tuesday, 20 December 2022 03:09 AM UTC
Thanks John

The customer was looking for more visibility than we already had, and unfortunately for various reasons - something in the lower right corner would not help much.

Is there more control of the title background available for the frames of the app sheets inside the mdi frame?
  1. Helpful
  1. John Fauss
  2. Tuesday, 20 December 2022 19:01 PM UTC
Not that I'm aware of.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 20 December 2022 19:43 PM UTC
  2. PowerBuilder
  3. # 4

Hi Glenn;

  Suggestion: I have code in the STD Framework that can place any CVUO (Custom or Standard Visual User Object) on your App's Menu Tool Bar, as follows:

     If you like this approach, would be to use this feature to add a UO at runtime that would delineate whether the App was running in DEV, UnitTest, Q/A, SystemTest, UAT ... Production. You can have any type of GUI interface you like, an combination of PB controls and any colour(s) settings you want on any of the CVUO controls. So you should be able to create an eye popping banner in the right hand area of the Menu bar that shows the App user what environment the App is currently running under. An alternative to the Window Title colour.

"Food for thought".


Regards ... Chris

  1. Glenn Barber
  2. Tuesday, 20 December 2022 20:45 PM UTC
Im already identifying the database being processed in the Window Title - however the customer specifically asked to change the Title Background color as what I was already doing was insuffiently noticeable to the users (which included a bright orange Windows MDI background) . As they sometimes are maintianing information in multiple databases - the users were still confusing which one they were in.

I am not sure an object to the far right or on the bottom would be sufficiently noticeable for them. But its worth thinking about.


  1. Helpful
  1. Glenn Barber
  2. Tuesday, 20 December 2022 20:49 PM UTC
Thinking about this - could the object be positioned first on the left?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 20 December 2022 21:02 PM UTC
My framework will right justify the UO by default as the menu bar icons are normally displayed starting from the left hand side.

However technically, you can position the UO where ever you like on the menu bar. Just adapt the UO Menu Bar code from the framework & refactor it to make it behave as you prefer. ;-)

  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.