Don't process last HDN_ITEMCHANGING notification
Just skipping last HDN_ITEMCHANGING arriving after HDN_ENDTRACK (to prevent emitting EVT_HEADER_RESIZING) when current column width is less than minimal value allowed is not enough because this notification will be handled by the native control in a standard way causing column width to resize below the limit. When current width is below the limit this last HDN_ITEMCHANGING notification has to be explicitly "vetoed" to prevent default handling from happening. Close #18335.
This commit is contained in:
@@ -747,7 +747,7 @@ bool wxHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
// HDN_ITEMCHANGED
|
||||
// In both cases last HDN_ITEMCHANGING notification is sent
|
||||
// after HDN_ENDTRACK so we have to skip it.
|
||||
if ( nmhdr->pitem && (nmhdr->pitem->mask & HDI_WIDTH) && m_isColBeingResized )
|
||||
if ( nmhdr->pitem && (nmhdr->pitem->mask & HDI_WIDTH) )
|
||||
{
|
||||
// prevent the column from being shrunk beneath its min width
|
||||
width = nmhdr->pitem->cxy;
|
||||
@@ -757,13 +757,19 @@ bool wxHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
// happening
|
||||
veto = true;
|
||||
}
|
||||
else // width is acceptable
|
||||
// width is acceptable and notification arrived before HDN_ENDTRACK
|
||||
else if ( m_isColBeingResized )
|
||||
{
|
||||
// generate the resizing event from here as we don't seem
|
||||
// to be getting HDN_TRACK events at all, at least with
|
||||
// comctl32.dll v6
|
||||
evtType = wxEVT_HEADER_RESIZING;
|
||||
}
|
||||
// else
|
||||
// Nnotification arriving after HDN_ENDTRACK is handled normally
|
||||
// by the control but EVT_HEADER_RESIZING event cannot be generated
|
||||
// because EVT_HEADER_END_RESIZE finalizing the resizing has been
|
||||
// already emitted.
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user