Fix repositioning of active property editor in wxPG

When there is open an editor for some property and in the same time
wxPropertyGrid layout is changed (due to the adding or removing a property,
sorting), it is necessary to recalculate the actual position of the active
editor to display it in the cell dedicated for the edited property. Under
some platforms the position of the edit control is shifted within the cell
and we have to take this shift into account in repositioning process.
Because actual value of the shift depends on the platform and on
the particular control, it is convenient to determine actual shift when
the editor is created and use this value whenever repositioning is done.

Close #17912.
This commit is contained in:
Artur Wieczorek
2017-07-16 19:15:07 +02:00
parent dd9c08447e
commit 6395e7805a
3 changed files with 21 additions and 16 deletions

View File

@@ -1039,6 +1039,8 @@ void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex,
tc->SetFocus();
m_labelEditor = wxStaticCast(tc, wxTextCtrl);
// Get actual position within required rectangle
m_labelEditorPosRel = m_labelEditor->GetPosition() - r.GetPosition();
m_labelEditorProperty = selected;
}
@@ -4198,6 +4200,17 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
m_wndEditor = wndList.m_primary;
m_wndEditor2 = wndList.m_secondary;
// Remember actual positions within required cell.
// These values can be used when there will be required
// to reposition the cell.
if ( m_wndEditor )
{
m_wndEditorPosRel = m_wndEditor->GetPosition() - goodPos;
}
if ( m_wndEditor2 )
{
m_wndEditor2PosRel = m_wndEditor2->GetPosition() - goodPos;
}
primaryCtrl = GetEditorControl();
//