diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index e7bfde366e..6ebd16505d 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1284,6 +1284,21 @@ public: m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT; } + /** + You can use this member function, for instance, to detect in + wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was + already called in wxPGEditor::OnEvent(). It really only detects + if was value was changed using wxPGProperty::SetValueInEvent(), which + is usually used when a 'picker' dialog is displayed. If value was + written by "normal means" in wxPGProperty::StringToValue() or + IntToValue(), then this function will return false (on the other hand, + wxPGProperty::OnEvent() is not even called in those cases). + */ + bool WasValueChangedInEvent() const + { + return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false; + } + /** Returns true if given event is from first of an array of buttons (as can be in case when wxPGMultiButton is used). */ diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index 1437c07abd..aecd686707 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -882,6 +882,18 @@ public: Shows an brief error message that is related to a property. */ void ShowPropertyError( wxPGPropArg id, const wxString& msg ); + + /** + You can use this member function, for instance, to detect in + wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was + already called in wxPGEditor::OnEvent(). It really only detects + if was value was changed using wxPGProperty::SetValueInEvent(), which + is usually used when a 'picker' dialog is displayed. If value was + written by "normal means" in wxPGProperty::StringToValue() or + IntToValue(), then this function will return false (on the other hand, + wxPGProperty::OnEvent() is not even called in those cases). + */ + bool WasValueChangedInEvent() const; }; diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 2bb5d600bc..b8e03c6268 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1259,7 +1259,7 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid, askColour = true; } - if ( askColour ) + if ( askColour && !propgrid->WasValueChangedInEvent() ) { // We need to handle button click in case editor has been // switched to one that has wxButton as well.