]> git.saurik.com Git - wxWidgets.git/commitdiff
avoid GTK "assertion `min < max' failed"
authorPaul Cornett <paulcor@bullseye.com>
Thu, 18 May 2006 02:39:23 +0000 (02:39 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 18 May 2006 02:39:23 +0000 (02:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/scrolbar.cpp
src/gtk/window.cpp

index 1c183e6a4d3c4734725ec536f1149431ecfc2fc3..13983bb7718c4ff6476b691a0a99978f8273858c 100644 (file)
@@ -182,6 +182,12 @@ void wxScrollBar::SetThumbPosition( int viewStart )
 
 void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool)
 {
 
 void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool)
 {
+    if (range == 0)
+    {
+        // GtkRange requires upper > lower
+        range =
+        thumbSize = 1;
+    }
     GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
     adj->value = position;
     adj->step_increment = 1;
     GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
     adj->value = position;
     adj->step_increment = 1;
index 030b872037e41be952e8ae231323af2f671cb12b..870c4c9ccb057844172ab8e12964adb97c257d2a 100644 (file)
@@ -4057,7 +4057,16 @@ void wxWindowGTK::SetScrollbar( int orient, int pos, int thumbVisible,
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
 
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
 
-    m_hasScrolling = true;
+    if (range > 0)
+    {
+        m_hasScrolling = true;
+    }
+    else
+    {
+        // GtkRange requires upper > lower
+        range =
+        thumbVisible = 1;
+    }
 
     const int i = orient == wxVERTICAL;
     GtkAdjustment* adj = m_scrollBar[i]->adjustment;
 
     const int i = orient == wxVERTICAL;
     GtkAdjustment* adj = m_scrollBar[i]->adjustment;