[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem Example -- Scroll-bar Max

Hi.  Earlier I described a problem with set-scroll-bar-max.  Here's an
example, lifted from the "library" folder, file "scroller.lisp":

;;  a dialog with a scroller in it

(setq foo (make-instance 'dialog))

(defclass scroller1 (scroller) ())

(defmethod scroll-bar-limits ((view scroller1))
  (normal-scroll-bar-limits view 200 200))

(defmethod view-draw-contents ((self scroller1))
  (frame-rect self 10 10 50 50)
  (paint-oval self 30 30 200 200)
  (erase-oval self 30 30 70 70)

(setq bar (make-instance 'scroller1
                 :view-container foo
                 :view-size #@(125 125)
                 :track-thumb-p t))

(setq v-scroll (slot-value bar 'v-scroller))

(slot-value v-scroll 'max)

(set-scroll-bar-max v-scroll 150)

Now, if you use the vertical scroll bar, use the arrows and go down to
the bottom.  You'll notice that you can go well below the large black
circle (it stops at 100, and the scroll-bar can now go down to 150).
You can go up and down with the arrows, BUT, once you use the up-arrow
on the vertical scroll bar to bring the elevator to the very top, the
scroll-bar-max gets reset to 100.  You can see this easily by going town
to the bottom again and noticing that you can't go as low as before.

The reason for this seems to be that the routine "update-scroll-bar-limits"
is getting called, which, when the 'setting' gets to 'min', resets the
scroll-bar-limits (min and max) to be consistent with the scroller-view
(the 'scrollee'?).  It seems that manually setting the scroll-bar-max
on a scroll-bar which is attached to a scroller region is not the
right way to take care re-sizing the scroll-bar.  Rather, I think I'll
have to make a call to update-scroll-bar-limits.