Set background color for wxTextEntryDialog

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
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Set background color for wxTextEntryDialog

Post by archman007 » Fri Sep 25, 2020 12:36 pm

Hello Folks,

I would like to change the background color for the wxTextEntryDialog.

I checked in this forum but did not find any examples.

How do I do that?

Thanks in Advance

User avatar
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Re: Set background color for wxTextEntryDialog

Post by archman007 » Fri Sep 25, 2020 12:40 pm

Version 3.1.3

User avatar
doublemax
Moderator
Moderator
Posts: 15260
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Set background color for wxTextEntryDialog

Post by doublemax » Fri Sep 25, 2020 1:08 pm

Did you try wxWindow::SetBackgroundColour?
https://docs.wxwidgets.org/trunk/classw ... d83b25d8a0
Use the source, Luke!

User avatar
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Re: Set background color for wxTextEntryDialog

Post by archman007 » Fri Sep 25, 2020 2:12 pm

wxTextEntryDialog dlg(



this, prompt, caption, wxInit,
(wxCANCEL | wxOK | wxTE_MULTILINE), wxPoint(50, 50));
this->SetBackgroundColour( * wxBLUE);
//dlg.SetBackgroundColour( * wxBLUE);

both attempts failed.

User avatar
doublemax
Moderator
Moderator
Posts: 15260
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Set background color for wxTextEntryDialog

Post by doublemax » Fri Sep 25, 2020 2:19 pm

Code: Select all

dlg.SetBackgroundColour( * wxBLUE);
That's the right one and works for me under Windows. What plaform are you on? If it's OSX, there's a good chance that you can't change the color. Apple is very strict about what's proper GUI design and what's not. And yes, changing the background of any window is a bad design decision 99% of the time on any platform.
Use the source, Luke!

User avatar
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Re: Set background color for wxTextEntryDialog

Post by archman007 » Fri Sep 25, 2020 2:26 pm

Operating System: Kubuntu 20.10
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.14.2
Kernel Version: 5.8.0-19-generic
OS Type: 64-bit
Processors: 6 × Intel® Core™ i5-8600K CPU @ 3.60GHz
Memory: 31.2 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630

Here is my configuration.

Thanks

User avatar
doublemax
Moderator
Moderator
Posts: 15260
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Set background color for wxTextEntryDialog

Post by doublemax » Fri Sep 25, 2020 3:19 pm

Try creating a wxDialog and try to change its background color. If that doesn't work, put a wxPanel on the dialog and set its background color. If any of these two work, you can at least build a new text entry dialog from scratch.
Use the source, Luke!

User avatar
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Re: Set background color for wxTextEntryDialog

Post by archman007 » Sat Sep 26, 2020 1:03 pm

While waiting for responses I began that process. The only drawback is when it time to select a file or directory that would be labor intensive. It make more sense to change the background color for the standard dialogs. The degree of difficulty to accomplish this is very high but is should not be.

The source is lacking.

Thanks

User avatar
doublemax
Moderator
Moderator
Posts: 15260
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Set background color for wxTextEntryDialog

Post by doublemax » Sat Sep 26, 2020 3:34 pm

My suggestion was only meant for small dialogs like wxTextEntry. I believe this is another *ubuntu oddity, i tested this on Q4OS (I usually don't use Linux, this was the only running Linux system i had at hand), and i could change the background color.
Use the source, Luke!

User avatar
archman007
Knows some wx things
Knows some wx things
Posts: 26
Joined: Mon Jan 13, 2020 1:06 pm

Re: Set background color for wxTextEntryDialog

Post by archman007 » Sat Sep 26, 2020 10:00 pm

Thank you for responding.

You da man!

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

Re: Set background color for wxTextEntryDialog

Post by ONEEYEMAN » Sat Sep 26, 2020 11:04 pm

Hi,
It also might depend on the theme (just a suggestion).

Thank you.

Post Reply