Custom scrolling (non-initarg scroll-bar)
OK so I have another question. I need to implement scrolling of a pane with a
separate scroll-bar, i.e. one added as part of a layout rather than through the
pane's initargs. Looking at 'scrolling-without-bar.lisp' in the examples I came
up with this -
(define-interface my-scroll-test ()
()
(:panes
(pane output-pane
:accessor pane
:horizontal-scroll :without-bar
:display-callback
#'(lambda (pane x y width height)
(declare (ignore x y width height))
(gp:draw-circle pane 100 100 50)))
(x-scroll scroll-bar
:callback 'scroll-pane))
(:layouts
(main-layout column-layout
'(pane
x-scroll)))
(:default-initargs
:layout 'main-layout
:best-height 400
:best-width 400))
(defun scroll-pane (interface self how where)
(declare (ignore self how))
(with-slots (pane) interface
(set-horizontal-scroll-parameters pane :slug-position where)))
But unfortunately it doesn't work. I've also tried this -
(define-interface my-scroll-test ()
()
(:panes
(pane output-pane
:accessor pane
:horizontal-scroll :without-bar
:display-callback
#'(lambda (pane x y width height)
(declare (ignore x y width height))
(gp:draw-circle pane 100 100 50))
:scroll-callback 'scroll-pane)
(x-scroll scroll-bar
:accessor x-scroll))
(:layouts
(main-layout column-layout
'(pane
x-scroll)))
(:default-initargs
:layout 'main-layout
:best-height 400
:best-width 400))
(defun scroll-pane (pane direction kind where &key &allow-other-keys)
(declare (ignore direction kind where))
(with-slots (x-scroll) (top-level-interface pane)
(set-horizontal-scroll-parameters pane
:slug-position (range-slug-start x-scroll))))
But that doesn't work either. I'm most likely making a simple error, but I can't
see it! If so I'll probably see it as soon as I've posted... if not, any help is
very much appreciated.
Thanks,
Chris