eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ScrollBar':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ScrollBar


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--ScrollBar
               |
               +--HorizontalScrollBar
               |
               +--SteppingSlider

Package:
stx:libwidg
Category:
Views-Interactors
Version:
rev: 1.100 date: 2018/11/09 23:27:09
user: cg
file: ScrollBar.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

Description:


this class implements vertical scrollbars with scroller and
2 step-scroll buttons. when moved or stepped, it performs a
predefined action.

The action is specified by:                 the block to be evaluated for step-up
    aScrollBar scrollUpAction:aBlock
    (scrollLeftAction for hor-Scrollbars)

    aScrollBar scrollDownAction:aBlock      the block to be evaluated for step-down
    (scrollRightAction for hor-Scrollbars)

    aScrollbar scrollAction:aBlock          the block to be evaluated for scroll
                                            passing percentage as argument.

Scrollbars can scroll synchronous (i.e. every movement is notified immediately via the
scrollAction) or asynchronous (i.e. only one notification takes place at the end of the movement).
The choice is up to the user of the scrollbar (typically, views which are complicated to redraw,
will set it to asynchronous.)

Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you
don't have to care for all the details).

The scrollBars and scrollers protocols have been made similar enough to
allow transparent use of either a scroller or a scrollBar in applications.


Related information:

    Scroller
    Slider
    ScrollableView

Class protocol:

style changes
o  updateStyleCache
extract values from the styleSheet and cache them in class variables


Instance protocol:

accessing
o  thumbHeight
return height of thumb in percent

o  thumbHeight: newHeight
set height of thumb in percent

o  thumbOrigin
return position of (top of) thumb in percent

o  thumbOrigin: newOrigin
set position of (top of) thumb in percent

o  thumbOrigin: newOrigin thumbHeight: newHeight
set origin and height of thumb (both in percent)

accessing-behavior
o  asynchronousOperation

o  beAsynchronous
set asynchronous-mode - scroll action is performed after movement
of scroller when mouse-button is finally released (no tracking).
This is forwarded to the scroller here.

o  beSynchronous
set synchronous-mode - scroll action is performed for every movement
of scroller (tracking).
This is forwarded to the scroller here.

o  isSynchronous
return true if the scroll-mode is synchronous.
If true, the scroll action is performed for every movement of the thumb (tracking).
If false, the scroll action is only performed at the end.

o  scrollAction: aBlock
set the action, aBlock to be performed when the scroller is moved.
This is forwarded to the scroller here.

o  scrollDownAction
return the action which is performed on scroll-down.
(vertical scrollBars)

o  scrollDownAction: aBlock
set the action, aBlock to be performed when the down-button is pressed.
(for vertical scrollBars)

o  scrollLeftAction
return the action which is performed on scroll-left
(for horizontal scrollBars)

o  scrollLeftAction: aBlock
set the action to be performed on scroll-left.
(for horizontal scrollBars)

o  scrollRightAction
return the action which is performed on scroll-right.
(for horizontal scrollBars)

o  scrollRightAction: aBlock
set the action to be performed on scroll-right.
(for horizontal scrollBars)

o  scrollUpAction
return the action which is performed on scroll-up.
(for vertical scrollBars)

o  scrollUpAction: aBlock
set the action, aBlock to be performed when the up-button is pressed.
(for vertical scrollBars)

o  synchronousOperation

accessing-components
o  downButton
return the down-button
(Please: only use this direct access for special applications)

o  thumb
return the thumb (i.e. the scroller subview)
(Please: only use this direct access for special applications)

o  upButton
return the up-button
(Please: only use this direct access for special applications)

accessing-look
o  allViewBackground: something if: condition
blocked for all scrollBars (I want my own background)

usage example(s):

^ super allViewBackground:something

o  orientation
for ST-80 compatibility, answer this query

o  orientation: aSymbol
set the orientation; either #horizontal or #vertical

o  thumbColor: aColor
set the thumbs color

o  upButtonLabel: label1 downButtonLabel: label2
set the labels shown in the buttons.
Because of the fixed button sizes, this only makes sense with
single-character strings or small bitmaps.

usage example(s):

also possible :
     |v|

     v := ScrollableView for:EditTextView.
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
     v scrollBar upButtonLabel:'u' downButtonLabel:'d'.
     v open

change & update
o  update: something with: aParameter from: changedObject

events
o  keyPress: key x: x y: y
(comment from inherited method)
a key has been pressed. If there are components,
pass it to the corresponding one.
Otherwise, forward it to the superview, if there is any.

o  sizeChanged: how
when my size changes, I have to resize/reposition the subviews.
Also, if I became too small, hide thumb/buttons.

focus handling
o  wantsFocusWithButtonPress
no, do not catch the keyboard focus on button click

forced scroll
o  pageDown
page down/right

o  pageUp
page up/left

o  scrollToBeginning
to top

o  scrollToEnd
to end

initialization
o  createElements
private: create my elements

o  defaultExtent
compute my extent from sub-components

o  initStyle
setup viewStyle specifics

o  initialize
setup; create the 2 buttons and a scroller

o  reinitialize

o  setElementPositions
position sub-components

native widget support
o  beNativeWidget

o  makeElementsInvisible
when using native widget, my elements are not visible.
(they are not destroyed, to keep a place for their attributes,
and to allow future dynamic switching and snapshot restore on
a non-native system)

o  nativeWindowType
return a symbol describing my native window type
(may be used internally by the device as a native window creation hint,
if the device supports native windows)

o  updateNativeWidget

private
o  changeVisibilityOf: aComponent to: aBoolean

o  enableDisableButtons
only used with styles which disable their buttons if the
thumb is at either end. Check where the thumb is and enable/disable
as appropriate.

private-scrollview interface
o  setThumbFor: aView
adjust thumb for aView
(i.e. adjust thumbs origin & size for views size & views contents).
This is forwarded to the scroller here.

o  setThumbHeightFor: aView
adjust thumbs height for aViews size & contents.
This is forwarded to the scroller here.

o  setThumbOriginFor: aView
adjust thumbs origin for aViews size & contents.
This is forwarded to the scroller here.

queries
o  computePreferredExtent
compute my extent from sub-components

o  isMiniScroller

o  isScrolling
true, if thumb is being moved (by user)



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 25 Apr 2024 04:45:24 GMT