SliderBar

The SliderBar provides an Windows style slider bar control.  This Window element is an automated combination of several other window components.

Summary
SliderBarThe SliderBar provides an Windows style slider bar control.
Implementation DetailsThe SliderBar is a combination window element that automates slider-box behavior from a set of more basic window components.
XML DefinitionThis is the SliderBar xml definition.
XML Tag
Required AttributesYou need to specify valid values for all of these elements to get the SliderBar to create properly.
backgroundThe name of a <HorizontalResizeIMage> definition for the bar background image.
tickmarkThe name of a DynamicImage definition that contains the texture coorddnates and size for a single tick mark
sliderbuttonThe name of a Button definition for the slider button
numticksThe number of tickmarks to display along the bar.
orientationChanges the internal functions to behave as if the slider bar was oriented horizontally or vertically.
locktoticksCauses the slider bar to only move to values the ticks are located at.
Window CallbacksThese are the SliderBar specific callback events.
Callbacks
OnSlideCalled when the bar’s position changes.
Functions
SliderBarSetDisabledFlag()Sets if slider is disabled.
SliderBarGetDisabledFlag()Returns if the slider is currently set to disabled.
Functions
Functions
SliderBarSetCurrentPosition()Sets the current position for the slider bar,
SliderBarGetCurrentPosition()Returns the current position for the slider bar,

Implementation Details

The SliderBar is a combination window element that automates slider-box behavior from a set of more basic window components.

Components

The SliderBar is comprised of the following components:

  • A HorizontalResizeImage definition for the ‘bar’ background.  This is sized to fit the width of the window.
  • A DynamicImage defintion to describe a single tick mark.  This will be tiled appropriately according to the numticks
  • A Button definition for the slider button.

Values

The slider maintains its position as a value betweeen 0.0 (all the way to the left) and 1.0 (all the way to the right).  If you wisht to use the slider for other ranges of values, you should do your calculation in your lua script.

Notes

XML Definition

This is the SliderBar xml definition.

Summary
XML Tag
Required AttributesYou need to specify valid values for all of these elements to get the SliderBar to create properly.
backgroundThe name of a <HorizontalResizeIMage> definition for the bar background image.
tickmarkThe name of a DynamicImage definition that contains the texture coorddnates and size for a single tick mark
sliderbuttonThe name of a Button definition for the slider button
numticksThe number of tickmarks to display along the bar.
orientationChanges the internal functions to behave as if the slider bar was oriented horizontally or vertically.
locktoticksCauses the slider bar to only move to values the ticks are located at.

XML Tag

<SliderBar>
....
</SliderBar>

Required Attributes

You need to specify valid values for all of these elements to get the SliderBar to create properly.

background

The name of a <HorizontalResizeIMage> definition for the bar background image.

Expects

A string value, which is the name of a valid <HorizontalResizeIMage>.

Default Value

  • ””

tickmark

The name of a DynamicImage definition that contains the texture coorddnates and size for a single tick mark

Expects

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

Default Value

  • ””

sliderbutton

The name of a Button definition for the slider button

Expects

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

Default Value

  • ””

numticks

The number of tickmarks to display along the bar.

Expects

A number value, 0n

Default Value

  • 3

orientation

Changes the internal functions to behave as if the slider bar was oriented horizontally or vertically.  SliderBars using an inappropriate orientation may render strangely but should function the same.

Expects

”horizontal” or “vertical”, substrings of these may or may not function

Default Value

  • ”horizontal”

locktoticks

Causes the slider bar to only move to values the ticks are located at.

Expects

”true” or “false”

Default Value

  • ”false”

Window Callbacks

These are the SliderBar specific callback events.

Summary
Callbacks
OnSlideCalled when the bar’s position changes.
Functions
SliderBarSetDisabledFlag()Sets if slider is disabled.
SliderBarGetDisabledFlag()Returns if the slider is currently set to disabled.

Callbacks

OnSlide

Called when the bar’s position changes.

Syntax

SomeSliderBar.OnSlide( curPos )
curPos(number) The current slide position.

Functions

SliderBarSetDisabledFlag()

Sets if slider is disabled.  When disabled, the slider button cannot slide.

Parameters

sliderName(string) The name of the slider.
isDisabled.(boolean) Should the slider be disabled?

Returns

nilno return value

Notes

  • Setting a slider to disabled does not update it’s artwork.  It prevents the slider button from moving.

Example

SliderBarSetDisabledFlag("MySlider", false )

SliderBarGetDisabledFlag()

Returns if the slider is currently set to disabled.

Parameters

sliderName(string) The name of the slider.

Returns

isDisabled.(boolean) Is the slider currently disabled?

Notes

  • none

Example

local isDisabled = SliderBarSetDisabledFlag("MySlider")

Functions

Summary
Functions
SliderBarSetCurrentPosition()Sets the current position for the slider bar,
SliderBarGetCurrentPosition()Returns the current position for the slider bar,

Functions

SliderBarSetCurrentPosition()

Sets the current position for the slider bar,

Parameters

sliderBarName(string) The name of the SliderBar.
position(number) The desired position, a value between 0.0 (all the way to the left) and 1.0 (all the way to the right).

Returns

nilno return value

Notes

  • none

Example

SliderBarSetCurrentPosition("ScenarioMapMenuWindowOpacitySlider", SystemData.Settings.Interface.tacticalMapAlpha)

SliderBarGetCurrentPosition()

Returns the current position for the slider bar,

Parameters

sliderBarName(string) The name of the SliderBar.

Returns

position(number) The current position, a value between 0.0 (all the way to the left) and 1.0 (all the way to the right).

Notes

  • returns nil on failure

Example

local value = SliderBarGetCurrentPosition( "ScenarioMapMenuWindowOpacitySlider" )
The DynamicImage provides a rectangular shaped display for a texture.
The button element automates generic button functionality, such as swapping texture and font colors automatically according to mouse over and state.
The name of a DynamicImage definition that contains the texture coorddnates and size for a single tick mark
The HorizontalResizeImage allows you to create an image that will automatically resize to fit a window of any width.
The number of tickmarks to display along the bar.