diff --git a/src/common/clrpickercmn.cpp b/src/common/clrpickercmn.cpp index f22482a2cd..a7597e979e 100644 --- a/src/common/clrpickercmn.cpp +++ b/src/common/clrpickercmn.cpp @@ -129,10 +129,7 @@ void wxColourPickerCtrl::OnColourChange(wxColourPickerEvent &ev) { UpdateTextCtrlFromPicker(); - // the wxColourPickerWidget sent us a colour-change notification. - // forward this event to our parent - wxColourPickerEvent event(this, GetId(), ev.GetColour()); - GetEventHandler()->ProcessEvent(event); + ev.Skip(); } #endif // wxUSE_COLOURPICKERCTRL diff --git a/src/generic/clrpickerg.cpp b/src/generic/clrpickerg.cpp index 58cd06ab8a..f9c923f1fc 100644 --- a/src/generic/clrpickerg.cpp +++ b/src/generic/clrpickerg.cpp @@ -91,9 +91,13 @@ void wxGenericColourButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev)) ms_data = dlg.GetColourData(); SetColour(ms_data.GetColour()); - // fire an event - wxColourPickerEvent event(this, GetId(), m_colour); - GetEventHandler()->ProcessEvent(event); + // Fire the corresponding event: note that we want it to appear as + // originating from our parent, which is the user-visible window, and not + // this button itself, which is just an implementation detail. + wxWindow* const parent = GetParent(); + wxColourPickerEvent event(parent, parent->GetId(), m_colour); + + ProcessWindowEvent(event); } } diff --git a/src/gtk/clrpicker.cpp b/src/gtk/clrpicker.cpp index 856421e94e..54f01a4d09 100644 --- a/src/gtk/clrpicker.cpp +++ b/src/gtk/clrpicker.cpp @@ -50,8 +50,11 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget, #endif p->GTKSetColour(gdkColor); - // fire the colour-changed event - wxColourPickerEvent event(p, p->GetId(), p->GetColour()); + // Fire the corresponding event: note that we want it to appear as + // originating from our parent, which is the user-visible window, and not + // this button itself, which is just an implementation detail. + wxWindow* const parent = p->GetParent(); + wxColourPickerEvent event(parent, parent->GetId(), p->GetColour()); p->HandleWindowEvent(event); } }