Scrollbar colors in Dark Mode

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
biggil
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Apr 20, 2012 7:10 am

Scrollbar colors in Dark Mode

Post by biggil » Fri Dec 04, 2020 3:53 pm

hello,
using wxWidgets 3.1.4, macos Mojave 10.14.6, XCode 10.3

After recompiling my apps on 3.1.4, I can see that in macos Dark Mode, my ScrollBars have bad colors. The background is white (should be dark gray) and the thumb is white too (should be medium gray).
Testing the samples coming with 3.1.4. I can see correct colors in Dark Mode !
My ScrollBars are parts of a wxScrolled window. (I didn't create them explicitely)
I searched something special about that in scroll.cpp (wxW. scroll sample), but didn't find.

What did I miss ?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5156
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Scrollbar colors in Dark Mode

Post by ONEEYEMAN » Fri Dec 04, 2020 11:43 pm

Hi,
Please try to reproduce in the Git master.
Also, check what is different between your app and the samples and see if you can make the sample look the same.

Thank you.

User avatar
biggil
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Apr 20, 2012 7:10 am

Re: Scrollbar colors in Dark Mode

Post by biggil » Sat Dec 05, 2020 12:12 pm

OK, I've found.
My wxScrolled<wxWindow> is attached (using Reparent() ) to a wxWindow on which I've called SetBackgroundColour(WHITE), I guess my view inheritates that ?
If I suppress this call, the scrollbars get normal colors in Light and Dark Mode :D

Meanwhile, it remains that using SetBackgroundColour() on a wxScrolled (or its parents) leads to:
- correct scrollbar colors in Light Mode,
- incorrect scrollbar colors in Dark Mode.

Seems to make SetBackgroundColour() unsuable with a wxScrolled, as the color drools into the scroll bar in Dark Mode ... only.
It that a "feature" ? or ...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5156
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Scrollbar colors in Dark Mode

Post by ONEEYEMAN » Sat Dec 05, 2020 2:01 pm

Hi,
Might be a problem with the Dark Mode.

Can you reproduce in a sample with the current master?

Thank you.

User avatar
biggil
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Apr 20, 2012 7:10 am

Re: Scrollbar colors in Dark Mode

Post by biggil » Sat Dec 05, 2020 8:48 pm

just add a line in scroll.cpp, in class MyAutoFrame, like this:

Code: Select all

class MyAutoFrame : public wxFrame
{
public:
    MyAutoFrame(wxWindow *parent)
        : wxFrame(parent, wxID_ANY, "MyAutoScrollingWindow")
    {
        SetBackgroundColour ( *wxYELLOW );  // ************** <----- THIS LINE ****************
        new MyAutoScrollingWindow(this);
        Show();
    }
};
In 3.1.4, it gives very strange results:
- started in Light mode, the Yellow color drolls into the window title bar (it's a wxFrame), and in the right-bottom corner (between the scrollbars)
- dragging the frame on another screen (I have multiple monitors) gives back the "normal" colors (no yellow)
- started in Dark mode, the Yellow color drolls and into the window title, and into the scrollbars of the daughter wxScrolled
- switching from Dark to Light, the to Dark, again, the look is now OK !
Thre are many strange cases, cannot describe all I've seen...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5156
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Scrollbar colors in Dark Mode

Post by ONEEYEMAN » Sat Dec 05, 2020 9:23 pm

Hi,
You should post in wx-users ML.
But first - try the Git master. See if it behaves the same...

Thank you.

User avatar
biggil
Knows some wx things
Knows some wx things
Posts: 26
Joined: Fri Apr 20, 2012 7:10 am

Re: Scrollbar colors in Dark Mode

Post by biggil » Sun Dec 06, 2020 6:51 am

sorry, what is the wx-users ML ?
and, sorry again, I'm not used with the Git Master.
I think I've found a sort a graphic bug about Light/Dark mode.
I've given a simple way to reproduce it.
I'm busy and I will not investigate further.
Now I hope somebody could put that in a todo-list somewhere, but I fear it could remain lost in a dead forum thread...

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 5156
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Scrollbar colors in Dark Mode

Post by ONEEYEMAN » Sun Dec 06, 2020 8:25 am

Hi,
It is possible that you did find a bug.
However, since you already have a reproduction steps and you are familiar with everything that is needed - why can't you verify its existence in the current code

It is pretty simple:

Code: Select all

git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git wxMaster
The latest code will be placed inside <pwd>/wxMaster.

I believe that the Git client is already installed on newer OSX. If not - grab the binary from https://git-scm.com/download/mac. And then repeat the command above.

Next, do the following:

Code: Select all

cd wxMaster
mkdir buildOSX
cd buildOSX
../configure <same set of configure options>
make
Use the same set of configure options you used when you build version 3.1.4.

After this build is done - build and run the same sample you used for testing with 3.1.4.

See if you can reproduce it with the current sources.
Thank you.

So, you don't need to know anything about "Git".
You just need to give couple of commands and everything will be done for you in a couple of minutes. Then run the build of the library and sample. Perform the same operation you did before with the current code.

No, real effort is actually necessary - everything will be done for you.
:D

Post Reply