Avoid showing the colour selection dialog twice in wxPropertyGrid.

Selecting "Custom" in a colour property cell resulted in the colour selection
dialog being shown twice if it was cancelled the first time.

Fix this by using wxPG_PROPERTY_SPECIFIC to indicate that the value is just
being queried and the user shouldn't be asked to enter it, as it is already in
the other places.

Closes #15543.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-22 14:15:05 +00:00
parent 6738f908f9
commit a52b9b5715
3 changed files with 22 additions and 4 deletions

View File

@@ -603,6 +603,7 @@ All (GUI):
- Support loading ICO files with data in PNG format (Artur Wieczorek).
- Fix dragging columns in wxGrid when some of them are hidden (Artur Wieczorek).
- Fix selecting elements from wxPropertyGrid enum properties (Artur Wieczorek).
- Don't show the dialog twice for colours in wxPropertyGrid (Artur Wieczorek).
wxGTK:

View File

@@ -1256,14 +1256,20 @@ bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
}
bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const
bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, int argFlags ) const
{
int index = number;
int type = m_choices.GetValue(index);
if ( type == wxPG_COLOUR_CUSTOM )
{
QueryColourFromUser(variant);
if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) )
return QueryColourFromUser(variant);
// Call from event handler.
// User will be asked for custom color later on in OnEvent().
wxColourPropertyValue val = GetVal();
variant = DoTranslateVal(val);
}
else
{
@@ -1442,7 +1448,18 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
return false;
}
QueryColourFromUser(value);
if ( (argFlags & wxPG_PROPERTY_SPECIFIC) )
{
// Query for value from the event handler.
// User will be asked for custom color later on in OnEvent().
ResetNextIndex();
return false;
}
if ( !QueryColourFromUser(value) )
{
ResetNextIndex();
return false;
}
}
else
{

View File

@@ -1285,7 +1285,7 @@ bool wxPGComboBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
return true;
}
bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE);
bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE|wxPG_PROPERTY_SPECIFIC);
// Changing unspecified always causes event (returning
// true here should be enough to trigger it).