Fix regression with spurious generic wxListCtrl columns resizing
Don't set default width every time the column is updated, as it happens
e.g. when it's clicked by the user, but only when it is created, by
moving the code added in 96d36383bd
(Use sensible default column width
in generic wxListCtrl too, 2021-08-17) from SetItem() to the ctor of
wxListHeaderData.
Closes #19256.
This commit is contained in:
@@ -298,6 +298,11 @@ wxListHeaderData::wxListHeaderData( const wxListItem &item )
|
||||
Init();
|
||||
|
||||
SetItem( item );
|
||||
|
||||
// Always give some initial width to the new columns (it's still possible
|
||||
// to set the width to 0 explicitly, however).
|
||||
if ( !(m_mask & wxLIST_MASK_WIDTH) )
|
||||
SetWidth(wxLIST_DEFAULT_COL_WIDTH);
|
||||
}
|
||||
|
||||
void wxListHeaderData::SetItem( const wxListItem &item )
|
||||
@@ -313,9 +318,8 @@ void wxListHeaderData::SetItem( const wxListItem &item )
|
||||
if ( m_mask & wxLIST_MASK_FORMAT )
|
||||
m_format = item.m_format;
|
||||
|
||||
// Always give some initial width to the new columns (it's still possible
|
||||
// to set the width to 0 explicitly, however).
|
||||
SetWidth(m_mask & wxLIST_MASK_WIDTH ? item.m_width : wxLIST_DEFAULT_COL_WIDTH);
|
||||
if ( m_mask & wxLIST_MASK_WIDTH )
|
||||
SetWidth(item.m_width);
|
||||
|
||||
if ( m_mask & wxLIST_MASK_STATE )
|
||||
SetState(item.m_state);
|
||||
|
Reference in New Issue
Block a user