HorizontalScrollbar

The HorizontalScrollbar is a combination window element that automates a scroll bar functionality.  While scroll bars can be used independently, they are most often used as a component of other scrolling windows such as the HorizontalScrollWindow.

Summary
HorizontalScrollbarThe HorizontalScrollbar is a combination window element that automates a scroll bar functionality.
XML DefinitionThis is the HorizontalScrollbar xml definition.
Implementation DetailsThe HorizontalScrollbar is a combination window element that automates a scroll bar functionality.
XML DefinitionThis is the HorizontalScrollbar xml definition.
XML Tag
Required AttributesRequired for the window element to create itself properly.
upName of the Button definition to use for the up button.
downName of the Button definition to use for the down button.
thumbName of the HorizontalResizeImage definition to use for the scaling scrollbar thumb.
gutterName of the HorizontalResizeImage definition to use for the background for the scroll area.
Optional Elements
UpOffsetThe offset for the UpButton from the top of the scrollbar window.
DownOffsetThe offset for the DownButton from the bottom left of the scrollbar window.
ThumbOffsetThe offset for the Thumb from the topleft of the scrollbar window.
ActiveZoneOffsetThe ActiveZone is the area outside of the scrollbar’s dimensions that you can still click and drag the scrollbar.
Window CallbacksThese are the HorizontalScrollBar specific callback events.
Callbacks
OnScrollPosChangedCalled when the scroll position has changed.
Functions
Functions
HorizontalScrollbarSetScrollPosition()Sets the current scroll position
HorizontalScrollbarGetScrollPosition()Returns the current scroll position
HorizontalScrollbarSetMaxScrollPosition()Sets the maximum scroll position
HorizontalScrollbarGetMaxScrollPosition()Returns the maximum scroll position.
HorizontalScrollbarSetPageSize()Sets the page size.
HorizontalScrollbarGetPageSize()Returns the page size.
HorizontalScrollbarSetLineSize()Sets the line size.
HorizontalScrollbarGetLineSize()Returns the line size.

XML Definition

This is the HorizontalScrollbar xml definition.

Implementation Details

The HorizontalScrollbar is a combination window element that automates a scroll bar functionality.  While scroll bars can be used independently, they are most often used as a component of other scrolling windows such as the HorizontalScrollWindow.

Components

(see ..\docs\images\HorizontalScrollbar_Example1.jpg)

When a scrollbar is sized, the background image resizes to fit it’s dimensions.  When used as part of annother window element, the scrollbar’s thumb will automatically size and position itself to reflect it’s parent window’s data.

When using a scrollbar on it’s own through lua, you need to set the following values according to your data

lineSizeThe height of a single line.  (Use HorizontalScrollbarSetLineSize() and HorizontalScrollbarGetLineSize())
pageSizeThe height for a full page.  (Use HorizontalScrollbarSetPageSize() and <HorizontalScrollbarGetPageLineSize()>)
maxScrollThe maximum value of your scroll range.  (Use HorizontalScrollbarSetMaxScrollPosition() and HorizontalScrollbarGetMaxScrollPosition())

XML Definition

This is the HorizontalScrollbar xml definition.

Summary
XML Tag
Required AttributesRequired for the window element to create itself properly.
upName of the Button definition to use for the up button.
downName of the Button definition to use for the down button.
thumbName of the HorizontalResizeImage definition to use for the scaling scrollbar thumb.
gutterName of the HorizontalResizeImage definition to use for the background for the scroll area.
Optional Elements
UpOffsetThe offset for the UpButton from the top of the scrollbar window.
DownOffsetThe offset for the DownButton from the bottom left of the scrollbar window.
ThumbOffsetThe offset for the Thumb from the topleft of the scrollbar window.
ActiveZoneOffsetThe ActiveZone is the area outside of the scrollbar’s dimensions that you can still click and drag the scrollbar.

XML Tag

<HorizontalScrollbar>
....
</HorizontalScrollbar>

Required Attributes

Required for the window element to create itself properly.

up

Name of the Button definition to use for the up button.

Expects

A string value, which is the name of a valid Button.

Default Value

  • ””

down

Name of the Button definition to use for the down button.

Expects

A string value, which is the name of a valid Button.

Default Value

  • ””

thumb

Name of the HorizontalResizeImage definition to use for the scaling scrollbar thumb.

Expects

A string value, which is the name of a valid HorizontalResizeImage.

Default Value

  • ””

gutter

Name of the HorizontalResizeImage definition to use for the background for the scroll area.

Expects

A string value, which is the name of a valid HorizontalResizeImage.

Default Value

  • ””

Optional Elements

UpOffset

The offset for the UpButton from the top of the scrollbar window.

Syntax

<UpOffset x="2" y="0" />
xThe x pixel offset from the top left corner of the window
yThe y pixel offset from the top left corner of the window

Defaults

x0
y0

DownOffset

The offset for the DownButton from the bottom left of the scrollbar window.

Syntax

<DownOffset x="2" y="0" />
xThe x pixel offset from the bottom left corner of the window
yThe y pixel offset from the bottom left corner of the window

Defaults

x0
y0

ThumbOffset

The offset for the Thumb from the topleft of the scrollbar window.

Syntax

<UpOffset x="2" y="0" />
xThe x pixel offset from the top left corner of the window
yThe y pixel offset from the top left corner of the window

Defaults

x0
y0

ActiveZoneOffset

The ActiveZone is the area outside of the scrollbar’s dimensions that you can still click and drag the scrollbar.  Windows seems to have an active zone of about 100 pixels on either side of a scrollbar.

Syntax

<ActiveZoneOffset x="100" y="0" />
xThe x pixel distance on either side of the scrollbar.
yThe y pixel distance on either side of the scrollbar.

Defaults

x0
y0

Window Callbacks

These are the HorizontalScrollBar specific callback events.

Summary
Callbacks
OnScrollPosChangedCalled when the scroll position has changed.

Callbacks

OnScrollPosChanged

Called when the scroll position has changed.

Syntax

SomeHorizontalScrollBar.OnScrollPosChanged( scrollPos )
scrollPos(number) The current scroll position ( 1 through the the scroll size / page size ).

Functions

Summary
Functions
HorizontalScrollbarSetScrollPosition()Sets the current scroll position
HorizontalScrollbarGetScrollPosition()Returns the current scroll position
HorizontalScrollbarSetMaxScrollPosition()Sets the maximum scroll position
HorizontalScrollbarGetMaxScrollPosition()Returns the maximum scroll position.
HorizontalScrollbarSetPageSize()Sets the page size.
HorizontalScrollbarGetPageSize()Returns the page size.
HorizontalScrollbarSetLineSize()Sets the line size.
HorizontalScrollbarGetLineSize()Returns the line size.

Functions

HorizontalScrollbarSetScrollPosition()

Sets the current scroll position

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.
scrollPos(number) The current scroll position.

Returns

nilNo return value

Notes

  • none

Example

HorizontalScrollbarSetScrollPosition("SomeScrollBar", 0 )

HorizontalScrollbarGetScrollPosition()

Returns the current scroll position

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.

Returns

scrollPos(number) The current scroll position.

Notes

  • none

Example

local scrollPos = HorizontalScrollbarGetScrollPosition( "SomeScrollBar" )

HorizontalScrollbarSetMaxScrollPosition()

Sets the maximum scroll position

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.
maxScrollPos(number) The maximum scroll position.

Returns

nilNo return value

Notes

  • none

Example

HorizontalScrollbarSetMaxScrollPosition("SomeScrollBar", 100 )

HorizontalScrollbarGetMaxScrollPosition()

Returns the maximum scroll position.

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.

Returns

maxScrollPos(number) The maximum scroll position.

Related XML

Notes

  • none

Example

local maxScrollPos = HorizontalScrollbarGetMaxScrollPosition("SomeScrollBar" )

HorizontalScrollbarSetPageSize()

Sets the page size.

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.
pageSize(number) The page size.

Returns

nilNo return value

Notes

  • none

Example

HorizontalScrollbarSetPageSize("SomeScrollBar", 10 )

HorizontalScrollbarGetPageSize()

Returns the page size.

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.

Returns

pageSize(number) The current page size.

Related XML

Notes

  • none

Example

local pageSize = HorizontalScrollbarGetPageSize("SomeScrollBar" )

HorizontalScrollbarSetLineSize()

Sets the line size.

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.
lineSize(number) The line size.

Returns

nilNo return value

Notes

  • none

Example

HorizontalScrollbarSetLineSize("SomeScrollBar", 10 )

HorizontalScrollbarGetLineSize()

Returns the line size.

Parameters

verticalScrollbarName(string) The name of the HorizontalScrollbar.

Returns

lineSize(number) The current line size.

Related XML

Notes

  • none

Example

local lineSize = HorizontalScrollbarGetLineSize("SomeScrollBar" )
The button element automates generic button functionality, such as swapping texture and font colors automatically according to mouse over and state.
The HorizontalResizeImage allows you to create an image that will automatically resize to fit a window of any width.
The HorizontalScrollWindow is a container window that provides a horizontal scrolling panel for all of it’s child windows.
Sets the line size.
Returns the line size.
Sets the page size.
Sets the maximum scroll position
Returns the maximum scroll position.
Name of the Ui Texture to use to create the tiled image..