From 5d40d57218e585fa61e286e80371d37cac95d4cc Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 22 Jan 2019 23:43:51 +0100 Subject: [PATCH] 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. --- src/msw/headerctrl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 966f6b04e5..db539f43ed 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -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;