Scrollbar

From Xojo Documentation

Revision as of 18:56, 19 November 2009 by WikiSysop (talk) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!


Description

The scrollbar control.


Super Class

RectControl

Because this is a RectControl, see the RectControl for other properties and events that are common to all RectControl objects.


Events

Name Parameters Return Type Description
GotFocus The scrollbar has received the focus (Windows and Linux).

On Linux, the scrollbar is not in the tab order but it gets the focus when the user clicks on it. Scrollbars do not get the focus on Macintosh even when the user is manipulating them.

LostFocus The scrollbar has lost the focus (Windows and Linux).
MouseDown x as Integer,

y as Integer

Boolean The mouse button was pressed inside the scrollbar at the location passed in to x,y. Returns a Boolean.

Return True if you are going to handle the MouseDown. The coordinates x, and y are local to the control. Point 0,0 is the top-left corner of the entire control.

MouseDrag x as Integer,

y as Integer

The mouse button was pressed inside the Scrollbar and moved (dragged) at the location local to the control passed in to x,y.

This event will not occur unless you return True in the MouseDown event.

MouseUp x as Integer,

y as Integer

The mouse button was released inside the scrollbar at the location passed in to x,y.

This event will not occur unless you return True in the MouseDown event.

ValueChanged The scrollbar value has changed.


Properties

Name Type Description
AcceptFocus
Introduced 2005r1
Boolean If True, the Scrollbar can accept the focus. The default is False.

This property is Windows-only. When the Scrollbar has the focus, the user can change its value with the arrow keys. Up and Left lower the value and Right and Down increase the value.

LineStep Integer The amount the value changes when a scroll arrow is clicked. The default is 1.
LiveScroll
Boolean If True, a ValueChanged event occurs as the user drags the thumbnail in the scrollbar. Otherwise, a single ValueChanged event occurs when the user stops dragging the thumbnail.
Maximum Integer The maximum value of the scrollbar. The default is 100.
Minimum Integer The minimum value of the scrollbar. The default is 0.
PageStep Integer The amount the value changes when the user clicks in the Scrollbar track.
Value Integer The current value of the scrollbar.


Notes

A Scrollbar can be either horizontal or vertical. To set its orientation programatically, set the height to be greater than the width for a vertical scrollbar. Set the width to be greater than the height for a horizontal scrollbar. The default thickness of the short side is 16 pixels, but it can be changed. You can narrow it in the IDE to get a mini-scrollbar.


Examples

Changing the maximum value of a Scrollbar at runtime:

ScrollBar1.maximum=200

Setting the text of a StaticText control to the value of the Scrollbar when the user scrolls:

Sub ValueChanged()
staticText1.text=Str(scrollbar1.value)

See also the discussion of scrolling ListBox controls horizontally using a Scrollbar control.


See Also

Slider control; RectControl class.