8.3 Canvas

Canvasses are used for grouping other window items together to form a single unit such that e.g. moving the canvas inside the window moves all the window items attached to the canvas. Canvas is a subpattern to windowItem.

8.4 Scroller

A scroller is a special kind of windowItem that has scrollbars associated with it. The purpose of the scroller is to act as a viewport, restricting the visibility of the window items attached to the scroller. The purpose of the scrollbars is to enable this viewport to be scrolled to another position:

[3kb 418x150 GIF]

Scrolling is realized through three patterns: abstractScroller, textEditor and scroller. AbstractScroller implements the general scrolling facilities with scrollbars etc. It defines a virtual pattern, contentsType, which defines the type of windowItem to be controlled by the abstractScroller. The two other scrollers then further bind this virtual to text and canvas, respectively.

The following is the previous example with an associated scroller:

Program 16: ovalScroll.bet

ORIGIN '~beta/guienv/guienv';
INCLUDE '~beta/guienv/figureitems';
INCLUDE '~beta/guienv/fields'
--- program: descriptor ---
guienv
(# scrollWindow: @window
     (# scroll: @scroller
          (# contentsType::
               (# go: @oval
                    (# open:: 
                         (# 
                         do (100, 100)->position;
                            (350, 450)->size;
                            7->pen.size
                         #);
                       eventhandler:: 
                         (# onMouseDown:: (# do drag #) #)
                    #);
                  open:: (# do go.open #)
               #);
             open:: 
               (# do true->bindBottom->bindRight #)
          #);
        eventhandler::
          (# onAboutToClose:: (# do terminate #) #);
        open::
          (#
          do (100, 100)->position;
             (300, 300)->size;
             'ovalScroll'->title;
             scroll.open;
             size->scroll.size
          #)
     #)
do scrollWindow.open
#)

Program 17: screendump (Windows NT)

[7kb 149x134 GIF]

Please note the use of

true -> bindBottom -> bindRight

in the definition of scroll. This informs Lidskjalv that scroll should extend towards the bottom and right if its enclosing window is resized. This facility is available for all windowItems.


Lidskjalv: User Interface Framework - Tutorial
© 1995-2002 Mjølner Informatics
[Modified: Friday October 27th 2000 at 14:56]