Discussions related to Visual Prolog
Faddey
Posts: 18
Joined: 11 Mar 2018 16:09

setBackGroundColor

Post by Faddey »

Dear Thomas.
There's a very useful predicate called setBackGroundColor.
Is it possible to get the current value of BackGroundColor and how can I do this?
User avatar
Thomas Linder Puls
VIP Member
Posts: 1499
Joined: 28 Feb 2000 0:01

Re: setBackGroundColor

Post by Thomas Linder Puls »

There is no built-in way to retrieve the current background color. The reason is that each control manages its own background rendering, and the standard controls do not expose a "current background color" property.

By default, the background color is determined by the system theme. I believe it is normally this color:

Code: Select all

ButtonBackgroundColor = gui_native::getSysColor(gui_native::color_btnface)
But when you call setBackgroundColor, this default behavior is overridden by PFC, which applies the specified color during rendering instead of the system color.

However, this override is not stored in a way that can be queried later via a predicate.

Therefore, if your application needs to know the current background color, the recommended approach is to store the value yourself when you set it.
Faddey
Posts: 18
Joined: 11 Mar 2018 16:09

Re: setBackGroundColor

Post by Faddey »

Thank you very much Thomas. I understand everything.