Futurebasic/Language/Reference/scroll button

< Futurebasic < Language < Reference

SCROLL BUTTON


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:

"Image was here"

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.

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 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 current, min nor 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 idExpr value).

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 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; EDIT FIELD; DIALOG function

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.