SCROLL BUTTON [#]idExpr ¬
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:
"Image was here"
To Create a New Scrollbar
- Choose an
idExprvalue such that
ABS(idExpr)is different from the ID's of all existing buttons and scrollbars in the window. If you use a negative
idExpr, and the window contains a multistyled non-static edit field whose ID number is
ABS(idExpr), then the actions of the scrollbar are linked to the edit field (explained below).
- Choose initial values for current, min, max and page. All of these parameters are optional; any of them that you omit will have the following default initial values:
- If creating a
_scrollOtherscrollbar, specify the
rectparameter. This parameter is optional if you're creating a
- Specify the type. This parameter is optional; its default value is
To Alter an Existing Scrollbar
idExprto the ID number of an existing scrollbar in the window.
- If you want to change any of the current, min, max or page values, specify the corresponding parameters. Any of these that you omit won't have their values changed.
- If you want to change the rectangle of a
_scrollOtherscrollbar, specify the new rectangle in the rect parameter. If you omit this parameter, the rectangle won't change. NOTE: the rect parameter is ignored when you're altering a
- You can't alter the type of an existing scrollbar. This parameter is ignored if the scrollbar already exists.
To Activate or De-activate a Scrollbar
You can use the
BUTTON statement to activate (highlight) or de-activate (dim) an existing scrollbar.
- To activate it, use:
BUTTON scrollbarID, _activeBtn
- To de-activate it, use:
BUTTON scrollbarID, _grayBtn
Linking a Scrollbar's Action to an Edit Field
If you specify a negative
idExpr value when creating a new scrollbar, FB looks for a multisyled edit field (which can be static) whose ID number equals
ABS(idExpr) in the current window. If such a field is found, the behavior of the scrollbar and the edit field become linked, as follows:
- When the user (or your program) moves the scrollbar thumb, the text in the edit field scrolls vertically;
- When the user (or your program) alters the text in the field, or drags through it vertically, the scrollbar thumb moves correspondingly.
When linking a scrollbar to an edit field, it's recommended that you use a vertical scrollbar. A horizontal scrollbar will not scroll the text horizontally, and its action is likely to look strange to the user.
You can't alter the
max parameters of a scrollbar that's linked to an edit field. These values are automatically altered dynamically as the content and position of the text in the field changes. Also, you can't use the
BUTTON statement to activate nor de-activate this kind of scrollbar; the scrollbar is active when the edit field contains more lines than will fit in the view rectangle, and is inactive otherwise.
Note: To link a scrollbar to an edit field, you must create the edit field first, and the scrollbar second.
Note: You can only link a scrollbar to a multistyled edit field (a field which was created using a negative
Using the Scrollbar
To make the scrollbar usable, 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
thumbPosition = BUTTON(scrollBarID)
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.
BUTTON& BUTTON function; BUTTON statement; EDIT FIELD; DIALOG function