SCROLLBARCREATE

Synopsis
SCROLLBARCREATE parent name xpos ypos width height callback
Description

Creates a scrollbar control. Scrollbar controls let the user select a value by sliding a "scroller" along a bar that represents a range of possible values. The position of the scrollbar is often linked to a static control that displays the scrollbar's current position, but this is not required.

When a scrollbar is first created, it has a range from 0 to 100 and an initial position of 0. You can change the range and position with SCROLLBARSET.

The orientation (vertical or horizontal) of the scrollbar is determined by the longest dimension. That is, if width > height, then the scrollbar is horizontal. Otherwise, the scrollbar is vertical.

The parent input is the name of the window that owns the new scrollbar. If no window or dialog with that name exists, then the FMSLogo screen window is used as the parent.

The name input identifies the new scrollbar and must be a unique word.

The xpos input is the X coordinate where the upper-left corner of the new scrollbar is placed.

The ypos input is the Y coordinate where the upper-left corner of the new scrollbar is placed.

The width input is the width of the new scrollbar. If the height input is greater than or equal to the width input, then the scrollbar is vertical and the system's default scrollbar width is used instead of the width input.

The height input is the height of the new scrollbar. If the height input is less than the width input, then the scrollbar is horizonal and the system's default scrollbar height is used instead of the height input.

The callback input is an instruction list that is run whenever the position of the scrollbar changes. One common use for the callback input is to inform the user of what value has been selected.

If the parent of the scrollbar is the FMSLogo screen window, then the xpos, ypos, width, and height inputs are all given in turtle coordinates. Otherwise, they are given in "dialog units", the origin is the upper-left corner of the parent, and Y values increase as you move down the screen.

Example

Create a scrollbar in a new window:

WINDOWCREATE "main "mywindow "mytitle 0 0 100 100 []
SCROLLBARCREATE "mywindow "myscroll 25 25 50 0 [SETHEADING SCROLLBARGET "myscroll]
SCROLLBARSET "myscroll 0 360 0
Move the scrollbar and observe what happens to the turtle.
WINDOWDELETE "mywindow

Create a scrollbar on FMSLogo screen window:

SCROLLBARCREATE "main "myscroll 25 25 100 0 [SETHEADING SCROLLBARGET "myscroll]
SCROLLBARSET "myscroll 0 360 0
Move the scrollbar and observe what happens to the turtle.
SCROLLBARDELETE "myscroll


SourceForge.net Logo