A pane which displays a scroll bar.
capi
range-pane
simple-pane
titled-object
:line-size |
The distance scrolled by the scroll-line gesture. |
:page-size |
The distance scrolled by clicking inside the scroll bar. |
:callback |
A function called after a scroll gesture, or nil . |
scroll-bar-line-size
scroll-bar-page-size
The class scroll-bar
implements panes which display a scroll bar and call a callback when the user scrolls. It is not however the most usual way to add scroll bars - see the note below about simple-pane.
line-size is the logical size of a line, and is the distance moved when the user enters a scroll-line gesture, that is clicking on one of the arrow buttons at either end of the scroll bar or using a suitable arrow key. The default value of line-size is 1.
page-size is the logical size of a page, and is the distance moved when the user clicks inside the scroll bar. The default value of page-size is 10.
callback can be nil
, meaning there is no callback. This is the default value. Otherwise, is a function of four arguments, the interface containing the scroll-bar, the scroll-bar itself, the mode of scrolling and the amount of scrolling. It has this signature:
callback interface scroll-bar how where
how can be one of :line
, :page
, :move
, or :drag
.
If how is :line
, then where is an integer indicating how many lines were scrolled.
If how is :page
, then where is an integer indicating how many pages were scrolled.
If how is :move
or :drag
, then where is an integer giving the new location of the slug-start, or :start
or :end
.
scroll-bar
, it is more usual to add scroll bars to a pane by the simple-pane initargs :horizontal-scroll
and :vertical-scroll
(defun sb-callback (interface sb how where) (declare (ignorable interface)) (format t "Scrolled ~a where ~a : ~a~%" how where (range-slug-start sb))) (contain (make-instance 'capi:scroll-bar :callback 'sb-callback :page-size 10 :line-size 2 :visible-min-width 200))
CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:57