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

Scroller's thumbs problem



                      Scroller's thumbs problem
;; I found a strange problem in the following situation.
;
;; A initial scroller size is setup as #@(184 184).
;; Resize the scrollable size to #@(400 400) by calling resize.
;; Click the window and the view size is changed correctly.
;; Now try to move (click) any of the scroller thumbs away from 0, and then
move it back to 0.
;; (This problem only happens when the thumbs are moved away and back to 0)
;; Click the view again, and the view size is automatically set back to #@(184
184).
;; But the view size at this point should still be #@(400 400). 
;; (i.e., Moving the thumbs away and back to 0 triggers the view size change.)


(require 'scrollers)

(defclass myscroller (ccl::scroller) ())

(defmethod view-click-event-handler ((self myscroller) where)
  (declare (ignore where))
  (print (point-string (make-point (scroll-bar-max (ccl::h-scroller self))
(scroll-bar-max (ccl::v-scroller self)))))
  (call-next-method))

(setq *w* (make-instance 'window
            :view-size #@(200 200)
            ))

(setq *myscroller* 
           (make-instance 'myscroller
             :view-container *w*
             :track-thumb-p t
             :view-size #@(184 184)
             :view-position #@(0 0)
      ))

(defmethod resize ((self myscroller) x y)
  (setf (scroll-bar-max (ccl::h-scroller self)) x)
  (setf (scroll-bar-max (ccl::v-scroller self)) y)
)

(resize *myscroller* 400 400)


#|
;;The problem can be fixed by adding the following code.
;;But should this be necessary?
;;What is the intended behavior of moving thumbs away and back to 0.

(defmethod view-click-event-handler :after ((self ccl::scroll-bar-dialog-item)
where)
  (declare (ignore where))
  (if (eq 0 (ccl::scroll-bar-setting self)) (resize *myscroller* 400 400))
)
|#

Sheldon Shen