Fix repositioning editors for horizontally scrolled grid

New method of calculating of the new position/size of the editor (introduced in 95461c566d) doesn't work well in all cases so we have to go back to the (modified) old method. To get the correct position of the editor cell from the absolute position of the splitter 0 we have to shift it by the origin of the scrolled view area.

See #18313.
This commit is contained in:
Artur Wieczorek
2019-01-04 19:50:44 +01:00
parent 066c422c81
commit 42b1cca8f2
3 changed files with 8 additions and 63 deletions

View File

@@ -1774,13 +1774,13 @@ wxWindow* wxPropertyGrid::GetEditorControl() const
// -----------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_3_0
void wxPropertyGrid::CorrectEditorWidgetSizeX()
{
int secWid = 0;
// Use fixed selColumn 1 for main editor widgets
int newSplitterx = m_pState->DoGetSplitterPosition(0);
int newSplitterx;
CalcScrolledPosition(m_pState->DoGetSplitterPosition(0), 0, &newSplitterx, NULL);
int newWidth = newSplitterx + m_pState->GetColumnWidth(1);
if ( m_wndEditor2 )
@@ -1816,32 +1816,6 @@ void wxPropertyGrid::CorrectEditorWidgetSizeX()
if ( m_wndEditor2 )
m_wndEditor2->Refresh();
}
#endif // WXWIN_COMPATIBILITY_3_0
void wxPropertyGrid::CorrectEditorWidgetSizeX(int xPosChange, int widthChange)
{
if ( m_wndEditor2 )
{
// if width change occurred, move secondary wnd by that amount
wxPoint p = m_wndEditor2->GetPosition();
p.x += xPosChange + widthChange;
m_wndEditor2->SetPosition(p);
}
if ( m_wndEditor )
{
wxRect r = m_wndEditor->GetRect();
r.x += xPosChange;
if ( !(m_iFlags & wxPG_FL_FIXED_WIDTH_EDITOR) )
r.width += widthChange;
m_wndEditor->SetSize(r);
}
if ( m_wndEditor2 )
m_wndEditor2->Refresh();
}
// -----------------------------------------------------------------------