Don't auto-resize wxDataViewCtrl columns below their initial size

It's unexpected that decreasing the width of the control makes the last
column diminish in size until nothing (at least if it's minimum size was
not set), instead of showing horizontal scrollbar, so prevent this from
happening by considering the initial column width as being "manually
set", which prevents the code from making the column narrower than it
automatically.

This seems to make sense and is consistent with the handling of initial
size, which becomes "best", and hence "minimal", size of the control,
for wxWindow.

Closes #18343.
This commit is contained in:
Vadim Zeitlin 2019-10-03 02:04:36 +02:00
parent 42ed52aec8
commit 0c90ea40c3

View File

@ -138,13 +138,18 @@ public:
if ( width == m_width )
return false;
// Normally we don't update it here as this method is called by
// UpdateColumnSizes() which resizes the column automatically, and not
// "manually", but if it's the first time the width is being set for a
// column created with the default width, do set m_manuallySetWidth in
// order to prevent the column from becoming narrower than its initial
// size when the control is resized, as this is unexpected.
if ( m_width == -1 )
m_manuallySetWidth = width;
m_width = width;
UpdateWidth();
// We must not update m_manuallySetWidth here as this method is called by
// UpdateColumnSizes() which resizes the column automatically, and not
// "manually".
return true;
}