UserGuide

Desktop Scrollbar

From Xojo Documentation

Scrollbar Library Icon

A Scroll Bar can be displayed vertically or horizontally. To add a Scroll Bar, simply drag the Vertical Scroll Bar or the Horizontal Scroll Bar from the Library to the Window Layout Editor.

The Scroll Bar can display in two different sizes. To turn a Scroll Bar into a mini-scrollbar, narrow the short side of the Scroll Bar. To resize it, you can either drag the object in the Window Layout Editor or change the control’s property. As you narrow the control, it will “snap” to its mini thickness.

Refer to Scrollbar in the Language Reference for details on all its events, properties and methods.

Below are the commonly used events, properties and methods.

Events

ValueChanged

Called when the scroll bar value has changed.

Properties

LineStep

An Integer that indicates the amount the scroll bar changes when one of its arrows is clicked (default is 1).

LiveScroll

When True, the ValueChanged event is called as the scroll bar thumbnail is dragged. When False, ValueChanged is called when dragging of the thumbnail stops.

Minimum, Maximum

The minimum and maximum values returned by the Scroll Bar.

PageStep

The Integer amount that the scroll bar changes when the empty track of the scroll bar is clicked.

Value

An Integer used to get or set current position of the scroll bar.

Focus

When a ScrollBar gets the focus on Windows, the thumb’s color changes. The ability of a ScrollBar to get the focus can be turned off by deselecting its AcceptFocus property.

Usage

You can use a Scroll Bar to provide scrolling to your own controls or to provide custom scrolling to built-in controls such as the ListBox.
Scrollbar Example Mac

Example Projects

  • ScrollBarExample: Examples/Desktop/Controls/ScrollBarExample
    This simple example demonstrates how to get the value when Scroll Bars are scrolled.
  • DownloadContainer: Examples/ContainerControls/DownloadContainer
    This more advanced example uses embeds multiple custom ContainerControls in a Canvas and lets you scroll through them using a vertical Scroll Bar.
  • CanvasScrolling: Examples/Graphics and Multimedia/CanvasScrolling
    This example displays a picture in a Canvas and lets you scroll around it using Scroll Bars.

See Also

Scrollbar class