]> git.saurik.com Git - wxWidgets.git/commitdiff
fix wxASSERT_MSG in PopStatusText: we always need to have at least one string in...
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 25 Apr 2009 13:10:07 +0000 (13:10 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Sat, 25 Apr 2009 13:10:07 +0000 (13:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/statbar.cpp

index 0dee67251b60d710ec495f5989452c4acbed7ad0..d27ddb0a4c762b3230fa05f0895b913d55dec03e 100644 (file)
@@ -197,11 +197,21 @@ void wxStatusBarBase::PushStatusText(const wxString& text, int number)
     SetStatusText(text, number);
         // update current status text (which will possibly be ellipsized) 
         // also in the native control
+
+    // SetStatusText() typically has an optimization built-in to avoid flickering
+    // which won't refresh the status bar pane if the current top of the stack
+    // is identic to the text passed to that function.
+    // Since this optimization however cannot detect push/pop operations on the stack
+    // we need to explicitely refresh the status bar pane ourselves:
+    wxRect rect;
+    GetFieldRect(number, rect);
+    Refresh(true, &rect);
+    Update();
 }
 
 void wxStatusBarBase::PopStatusText(int number)
 {
-    wxASSERT_MSG(m_panes[number].m_arrStack.GetCount() >= 1,
+    wxASSERT_MSG(m_panes[number].m_arrStack.GetCount() > 1,
                  "can't pop any further string");
 
     // the top of the stack is the status text currently shown in the native control;
@@ -211,6 +221,13 @@ void wxStatusBarBase::PopStatusText(int number)
     // restore the previous status text in the native control
     const wxString& text = m_panes[number].m_arrStack.back();
     SetStatusText(text, number);
+
+    // see comment in wxStatusBarBase::PushStatusText about why we need to explicitely
+    // refresh the status bar pane
+    wxRect rect;
+    GetFieldRect(number, rect);
+    Refresh(true, &rect);
+    Update();
 }
 
 #endif // wxUSE_STATUSBAR