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

Re: ccl:scrolling window bug?



>I'm not sure if there is a reason for not doing this, but I've noticed
>that the class ccl::scrolling-windows does not seem to set the update
>region to exclude it's own scroll bars before it continues with the call
>chain.  This means that any views inside of it will automatically draw
>into the scroll bar area.  I'm assuming that the "view-draw-contents"
>methods are all called with the appropriate "with-focused-view" or 
>"with-focused-dialog-item" by the call chain (read that as I'm not
>using this macro within my "view-draw-contents" methods since I assumed
>all that is automatically handled).  Also note that resizing a scrolling
>window is what brings out this view.  If I simply cover up the subview with
>another window (such as the listener), then uncover it, the scroll bars
>seem to be drawn properly.
>
>Is there a fix available for this or am I doing this wrong?

A SCROLLING-WINDOW instance does not expect any subviews besides the
three it creates (a SCROLLER and two scroll bars). Hence, you need
to change your example by making your TEST-VIEW class inherit from
SCROLLER, and by passing a :SCROLLER-CLASS initarg to the MAKE-INSTANCE
for the SCROLLING-WINDOW:

--------------------------------------------------------------------

(require "QUICKDRAW")
(require "SCROLLING-WINDOWS")

;; define a test class
(defclass test-view (scroller)
  nil)

;; make this a separate routine, so we can move it around the call chain easily
(defmethod draw-code ((me test-view))
   (with-fore-color *yellow-color*
    (paint-rect me 0 0 (point-h (view-size me)) (point-v (view-size me))))
  (with-fore-color *red-color*
    (move-to me 0 0)
    (line-to me (point-h (view-size me)) (point-v (view-size me)))
    (move-to me (point-h (view-size me)) 0)
    (line-to me 0 (point-v (view-size me)))))

(defmethod view-draw-contents ((me test-view))
  (draw-code me))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Create the window with a large subview in it
;;

(make-instance 'ccl::scrolling-window
  :window-title "test"
  :color-p t
  :view-size #@(285 85)
  :scroller-class 'test-view
  :track-thumb-p t)                     ; real-time scrolling