FutureBasic Logo

<<    Index    >> FutureBasic 5

scroll button   statement



Syntax:
scroll button [#]idExpr ¬
  [,[current][,[min][,[max][,[page][,[rect][,type]]]]]]


Description:
The scroll button statement puts a new scrollbar in the current output window, or alters an existing scrollbar's characteristics. The parameters are interpreted as follows:

ParameterDescription
idExprAn integer which identifies the scrollbar. If Abs(idExpr) is different from the ID numbers of all buttons and all other scrollbars in the current window, a new scrollbar is created, and is assigned an ID number equal to Abs(idExpr). If Abs(idExpr) equals the ID of an existing scrollbar, the scrollbar's characteristics are altered.
currentThis sets the current "value" of the scrollbar, which, along with min and max, determines the position of the scrollbar's "thumb." It must be greater than or equal to min, and less than or equal to max.
minThe minimum value that the scrollbar can have. For vertical scrollbars, this corresponds to a thumb position at the top of the bar; for horizontal scrollbars, it corresponds to a thumb position at the left side of the bar. min must be in the range -32768 through +32767.
maxThe maximum value that the scrollbar can have. For vertical scrollbars, this corresponds to a thumb position at the bottom of the bar; for horizontal scrollbars, it corresponds to a thumb position at the right side of the bar. max must be in the range -32768 through +32767, and must be greater than min.
pageThis specifies the amount by which the scrollbar's value should change when the user clicks in the areas between the thumb and the scrollbar's end-arrows. Must be non-negative.
rectFor scrollbars of type _scrollOther, the rect parameter specifies the rectangle that defines the size and position of the scrollbar. You can specify it in either of two ways:

(x1,y1)-(x2,y2) - Coordinates of two diagonally opposite points.

rectAddr& - Address of an 8-byte rectangle structure. If the specified rectangle is wider than it is tall, the scrollbar becomes a horizontal scrollbar. If the rectangle is taller than it is wide, the scrollbar becomes a vertical scrollbar. The standard recommended width for a vertical scrollbar (or height for a horizontal scrollbar) is 16 pixels.

Note: For scrollbars of type _scrollHorz or _scrollVert, the rect parameter is interpreted differently. See below for more details.
typeSpecify one of the following:

_scrollOther:
The scrollbar occupies the rectangle specified in the rect parameter.

_scrollVert:
The scrollbar occupies the right edge of the window, and is resized as the window is resized. If you specify a rect parameter when creating the scrollbar, the top of the scrollbar is offset from the top of the window by y1 pixels.

_scrollHorz:
The scrollbar occupies the bottom edge of the window, and is resized as the window is resized. If you specify a rect parameter when creating the scrollbar, the left side of the scrollbar is offset from the left side of the window by x1 pixels.

Note: _scrollVert and _scrollHorz scrollbars can only be put into windows of type _doc, _docZoom and _docNoGrow. If you try to create a _scrollVert or _scrollHorz scrollbar in any other type of window, the scrollbar won't appear.

To Create a New Scrollbar:
To Alter an Existing Scrollbar:
To Activate or De-activate a Scrollbar:
You can use the button statement to activate (highlight) or de-activate (dim) an existing scrollbar.
Using the Scrollbar
To make the scrollbar useable, your program must call HandleEvents periodically. Among other things, HandleEvents tracks the motion and clicking of the mouse in the scrollbar, and moves the thumb in response to these user actions. Your program can also move the thumb explicitly by setting the current parameter in the scroll button statement.
Whenever the user moves the thumb, a dialog event of type _btnClick is generated. The "id" value for this event equals the scrollbar's ID. You can determine the thumb's current position using the button function:
thumbPosition = button(scrollBarID)

Note:
To remove a scrollbar, use the button close statement:
button close scrollBarID
To find out information about a scrollbar, use the button& function to get the scrollbar's control record.

See Also:
button&; button function; button statement; dialog function