My understanding is the native (Cocoa) Mac color picker is "dynamic" by nature, i.e., no OK/Cancel buttons,
see for example at https://www.youtube.com/watch?v=MQqntlvhGLg.
So I'm trying to to catch wxEVT_COLOUR_CHANGED events, to dynamically update the color while the color picking window
is open, but no events are ever returned:
Code: Select all
// Color picker
m_contextMenu.Bind(wxEVT_MENU,
[this](wxCommandEvent &)
{
// Get initial color
wxColourData new_color;
new_color.SetColour(GetActiveLineColor());
// Open dialog and keep returning an updated color whenever selected
wxColourDialog dlg(this, &new_color);
dlg.Bind(wxEVT_COLOUR_CHANGED, [this](wxColourDialogEvent& event) {
SetActiveLineColor(event.GetColour());
wxLogMessage("new color selected");
Update();
});
if ( dlg.ShowModal() == wxID_OK ) {
// Colour did change.
} else {
// Colour didn't change.
}
}, wxID_SELECT_COLOR );
If so, what should I do then, just get the final color returned by the window whatever flag ShowModal returns with?
Thank you in advance,
Federico