A scroll_bar
object allows the user to examine and modify the position of a view
--provided by some window-- onto a larger object. Scrollbars are
normally attached to windows, editors and list_browsers. Scrollbars
probably are rarely used by normal PCE application programmers. They may
be used in combination with class figure
using figure->clip_area
to create a mini-window (note that windows may also be
displayed on other window
objects).
A scroll_bar assumes there is an object of a certain size and a
scroll_bar<-view
on this object that allows the user to see part of it. This part is
defined by a scroll_bar<-start
position and a scroll_bar<-length.
See
scroll_bar->bubble’A
scroll_bar is a normal graphical
object. To connect it to some other object, two communications should be
established:
scroll_bar->request_compute
message. When XPCE's redraw system is activated, scroll_bar->compute
will be called to update the scrollbar. See scroll_bar->compute
for the methods that need to be provided by the scrolled scroll_bar<-object
to make this connection work.
object<-object
as follows:
If scroll_bar<-message
equals @default,
invoke scroll_bar->scroll_vertical on scroll_bar<-object
if scroll_bar<-orientation
equals vertical and
scroll_bar->scroll_horizontal if scroll_bar<-orientation
equals horizontal. This method is passed three arguments: direction,
unit and amount.
If direction equals forwards, the view
should move further down/right the object. Unit may be
page, in which case amount is the permillage
of page the view should be moved or line, in which case amount
is the number of lines to move.
If direction equals backwards, the same
parameters are passed, but the view should be moved up/left.
If direction equals goto, amount
is a permillage indicating an absolute position in the file: 0
means goto the top/left, 1000 to the bottom/right.
.repeat_delay.
->event
and
scroll_bar<-message.
The values are:
unitdirectionfile, -direction is goto.
amountfile or page, this is a
promilage. Thus, {file, goto, 300} goes to 30% of the file,
{page, forwards, 500} goes half a page down. For -unit is line, this is
a line-count.
->place.->bubblex, which implies compatible
with the scrollbars from the Xaw library. Future version should offer
Motif and OpenLook compatible versions of the scrollbar.
Inherits description from: dialog_item-look
scroll_bar <-startStart of the visible part scroll_bar <-viewLength of the view part scroll_bar <-lengthTotal length of the object
The returned values are integers. The unit is not important as a scroll_bar only considers the relative values.
<-width
and graphical<-height
are swapped.left or right and top or
bottom’, separated by spaces. It determines where the scroll_bar
is placed using scroll_bar->place.->bubble->bubble
<-length, scroll_bar<-start
and scroll_bar<-view
tell the scrollbar which part of the object scrolled is currently in the
window:
scroll_bar ->lengthTotal size of the object scroll_bar ->startStart of the visible part scroll_bar ->viewSize of the visible part
The method scroll_bar->bubble
allows the user to change all three parameters with one message. See
also scroll_bar->compute.
<-request_compute
is not @nil,
this method will:
<-object
has the send method
scroll_bar->bubble_scroll_bar. If this is
the case, this method is called with this scrollbar as argument. The
receiving object is supposed to activate scroll_bar->bubble,
passing the current viewport settings to the scrollbar.
<-object
has all the methods scroll_bar<-start, scroll_bar<-view
and scroll_bar<-length,
the scrollbar will invoke them and update the viewport using the result.
Backward compatibility only.
If the scrolled object or the viewport is modified, the window or
scroll_bar<-object
should invoke graphical->request_compute
on the scroll_bar to activate this mechanism.
<-look.
After user-interaction that should affect the scrolled scroll_bar<-object,
the scroll_bar
object determines -direction, -unit and -amount. Next:
->scroll_vertical:
-direction, -unit, -amount on the associated scroll_bar<-object
if scroll_bar<-orientation
is vertical and scroll_bar->scroll_horizontal
otherwise. If this method is understood and succeeds the event is
considered handled. See, for example, window->scroll_vertical
<-message.
object either horizontally or
vertically. See also scroll_bar->message.<-object
is used. Exploits the variables
scroll_bar <-placementto place left/right, top/bottom. scroll_bar <-distanceto determine the distance to the object.
The scrollbar is displayed on the same graphical<-device
as the given graphical.