Fix wxPropertyGrid::DoEndLabelEdit function, cont.

Explicit cell content handling for edited label is necessary only for column other then 0 because cell handling for label in column is 0 is done inside wxPGProperty::SetLabel() function.
This commit is contained in:
Artur Wieczorek
2015-05-13 20:51:50 +02:00
parent 1cd916fc0a
commit b7c4b51b41

View File

@@ -1093,22 +1093,31 @@ void wxPropertyGrid::DoEndLabelEdit( bool commit, int selFlags )
} }
wxString text = m_labelEditor->GetValue(); wxString text = m_labelEditor->GetValue();
// Cell handling for label in column 0
// is done internally in SetLabel() function
if ( labelColIdx == 0 )
{
prop->SetLabel(text);
}
else
{
wxPGCell* cell = NULL; wxPGCell* cell = NULL;
if ( prop->HasCell(labelColIdx) ) if ( prop->HasCell(labelColIdx) )
{ {
cell = &prop->GetCell(labelColIdx); cell = &prop->GetCell(labelColIdx);
} }
else if ( labelColIdx != 0 ) else
{ {
cell = &prop->GetOrCreateCell(labelColIdx); cell = &prop->GetOrCreateCell(labelColIdx);
} }
if ( labelColIdx == 0 )
prop->SetLabel(text);
if ( cell && cell->HasText() ) if ( cell && cell->HasText() )
{
cell->SetText(text); cell->SetText(text);
} }
}
}
m_selColumn = 1; m_selColumn = 1;
int wasFocused = m_iFlags & wxPG_FL_FOCUSED; int wasFocused = m_iFlags & wxPG_FL_FOCUSED;