wxColourDialog being insane

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
DaleyPaley
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Jan 18, 2022 11:20 am

wxColourDialog being insane

Post by DaleyPaley »

I have a menu item whose event opens a colour dialog.
No matter what I do, the dialog always returns the foreground colour of a text control. There is no mention of the foreground colour in that function but wxWidgets magically gets it to return it.
I have tried with both wxColourDialog and wxGetColourFromUser. I mean, it's a simple as you can get:

Code: Select all

wxColour clr = wxGetColourFromUser(this, *wxRED, "Please choose the background colour");
if ( clr.IsOk() ) std::cout << "clr = " << clr.GetAsString() << "\n";
Now matter what colour I select, this ALWAYS returns the foreground colour of an unrelated textctrl. And it's the same if I use wxColourDialog. It's insane.
It doesn't help that Apple's stupid colour picker doesn't have accept/cancel buttons.
Also, if I use wxColourDialog, the dialogue decides by itself to pop up on launch next time I run the app. How on earth to tell it to shut up?
I also tried binding the wxEVT_COLOUR_CHANGED event, but that didn't work at all.
I found a thread possibly talking about the issue from 2012, but it goes nowhere.
https://groups.google.com/g/wx-dev/c/g6ocx9t7Ufc
I have had the colour picker work in previous projects, it's just being a bitch this time. No idea what else I can try.
Has anyone else run into this problem?
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxColourDialog being insane

Post by doublemax »

Together with the strange issues you reported in your previous thread, it sounds like there might be something wrong with your build.

Please try to build wxWidgets, and the samples that are relevant for your issues, from scratch using the command line.
Use the source, Luke!
Post Reply