[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re- Scroller's thumbs probl
- Subject: Re- Scroller's thumbs probl
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Wed, 26 May 93 15:47:32 -0400
>I am not sure if Bill St. Clair's code works because if you click inside the
>*myscroller*,
>it always reports #@(184 184), not #@(400 400).
>
>I tried to add
>(setf (scroll-bar-max (ccl::h-scroller self)) x)
> (setf (scroll-bar-max (ccl::v-scroller self)) y)
>to the resize method.
>
>Now, Clicking initially shows #@(400 400).
>But moving the thumb away and back to 0, the scroll-bar-max is 184 again.
>
>I said I am not sure because I did not know how scroll-bar-limits works.
>Particularly, what's the relationship between scroll-bar-limits and
>scroll-bar-max?
>Setting scroll-bar-limits does not seem to set scroll-bar-max.
Sorry, I forgot a couple of "CCL::" package prefixes. My code should
have read as follows. This time I actually tried it in an MCL 2.0
instead of in my development CCL. ccl::scroll-bar-limits returns
two values.
1) (make-point h-scroll-bar-min h-scroll-bar-max)
2) (make-point v-scroll-bar-min v-scroll-bar-max)
It is called by ccl::update-scroll-bar-limits, which is called
whenever the scroll bar thumb is moved to 0.
------------------------------------------------------------------------
(require 'scrollers)
(defclass myscroller (ccl::scroller)
((limits :initform (cons nil nil)
:reader scroll-bar-limits-slot)))
(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 ccl::scroll-bar-limits ((self myscroller))
(let ((limits (scroll-bar-limits-slot self))
(size (view-size self)))
(values
(or (car limits) (point-h size))
(or (cdr limits) (point-v size)))))
(defmethod resize ((self myscroller) x y)
(let ((limits (scroll-bar-limits-slot self)))
(setf (car limits) (make-point 0 x))
(setf (cdr limits) (make-point 0 y)))
(ccl::update-scroll-bar-limits self)
)
(resize *myscroller* 400 400)