Fix autosizing empty columns in wxMSW wxListCtrl
Autosizing the column by double clicking on its separator line reset it to the default width when the control was empty, which isn't especially useful. Set the column size to fit its header instead. Closes #9926. See https://github.com/wxWidgets/wxWidgets/pull/1573
This commit is contained in:
committed by
Vadim Zeitlin
parent
654bfaea31
commit
0e0ea2ad84
@@ -2290,6 +2290,21 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
event.m_col = nmHDR->iItem;
|
||||
break;
|
||||
|
||||
case HDN_DIVIDERDBLCLICK:
|
||||
{
|
||||
NMHEADER *pHeader = (NMHEADER *) lParam;
|
||||
// If the control is non-empty, the native control will
|
||||
// autosize the column to its contents, however if it is empty,
|
||||
// it just resets it to some default width, while we want to
|
||||
// still autosize it in this case, to fit its label width.
|
||||
if ( IsEmpty() )
|
||||
{
|
||||
SetColumnWidth(pHeader->iItem, wxLIST_AUTOSIZE_USEHEADER);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NM_RCLICK:
|
||||
{
|
||||
POINT ptClick;
|
||||
|
Reference in New Issue
Block a user