From 796be9238d0ff9a37c97198999f9af8fd0f8d681 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 11 Oct 2011 17:14:09 +0000 Subject: [PATCH] Update status bar labels properly after width change in wxMSW. The labels were not updated (i.e. ellipsized or, on the contrary, displayed in full) correctly after a status bar field was changed; there was even a FIXME comment about this in the code. Fix this by calling DoUpdateStatusText() when the field width is changed and also update the field width after resetting the existing tooltips. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/statusbar.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index a63dcc4fb6..b82db9553b 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -176,10 +176,6 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths) // this is a Windows limitation wxASSERT_MSG( (nFields > 0) && (nFields < 255), "too many fields" ); - wxStatusBarBase::SetFieldsCount(nFields, widths); - - MSWUpdateFieldsWidths(); - // keep in synch also our m_tooltips array // reset all current tooltips @@ -189,7 +185,11 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths) } // shrink/expand the array: - m_tooltips.resize(m_panes.GetCount(), NULL); + m_tooltips.resize(nFields, NULL); + + wxStatusBarBase::SetFieldsCount(nFields, widths); + + MSWUpdateFieldsWidths(); } void wxStatusBar::SetStatusWidths(int n, const int widths[]) @@ -233,6 +233,8 @@ void wxStatusBar::MSWUpdateFieldsWidths() { nCurPos += widthsAbs[i] + extraWidth; pWidths[i] = nCurPos; + + DoUpdateStatusText(i); } // The total width of the panes passed to Windows must be equal to the @@ -246,9 +248,6 @@ void wxStatusBar::MSWUpdateFieldsWidths() } delete [] pWidths; - - - // FIXME: we may want to call DoUpdateStatusText() here since we may need to (de)ellipsize status texts } void wxStatusBar::DoUpdateStatusText(int nField) -- 2.45.2