Added wxPropertyGrid::WasValueChangedInEvent(), added code to avoid showing colour picker dialog twice when 'Custom' colour was picked from drop-down list

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-07-11 07:59:59 +00:00
parent 858102d740
commit eddcc4b442
3 changed files with 28 additions and 1 deletions

View File

@@ -1284,6 +1284,21 @@ public:
m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT; 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 /** Returns true if given event is from first of an array of buttons
(as can be in case when wxPGMultiButton is used). (as can be in case when wxPGMultiButton is used).
*/ */

View File

@@ -882,6 +882,18 @@ public:
Shows an brief error message that is related to a property. Shows an brief error message that is related to a property.
*/ */
void ShowPropertyError( wxPGPropArg id, const wxString& msg ); 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;
}; };

View File

@@ -1259,7 +1259,7 @@ bool wxSystemColourProperty::OnEvent( wxPropertyGrid* propgrid,
askColour = true; askColour = true;
} }
if ( askColour ) if ( askColour && !propgrid->WasValueChangedInEvent() )
{ {
// We need to handle button click in case editor has been // We need to handle button click in case editor has been
// switched to one that has wxButton as well. // switched to one that has wxButton as well.