Skip to content

Latest commit

 

History

History
79 lines (43 loc) · 3 KB

GuiSliderCtrl.rst

File metadata and controls

79 lines (43 loc) · 3 KB

GuiSliderCtrl

A control that displays a value between its minimal and maximal bounds using a slider placed on a vertical or horizontal axis.

Inherit:

GuiControl

Description

A control that displays a value between its minimal and maximal bounds using a slider placed on a vertical or horizontal axis.

A slider displays a value and allows that value to be changed by dragging a thumb control along the axis of the slider. In this way, the value is changed between its allowed minimum and maximum.

To hook up script code to the value changes of a slider, use the command and altCommand properties. command is executed once the thumb is released by the user whereas altCommand is called any time the slider value changes. When changing the slider value from script, however, trigger of altCommand is suppressed by default.

The orientation of a slider is automatically determined from the ratio of its width to its height. If a slider is taller than it is wide, it will be rendered with a vertical orientation. If it is wider than it is tall, it will be rendered with a horizontal orientation.

The rendering of a slider depends on the bitmap in the slider's profile. This bitmap must be a bitmap array comprised of at least five bitmap rectangles. The rectangles are used such that:

Example:

// Create a sound source and a slider that changes the volume of the source.

%source = sfxPlayOnce( "art/sound/testing", AudioLoop2D );

new GuiSlider()
{
   // Update the sound source volume when the slider is being dragged and released.command = %source @ ".setVolume( $ThisControl.value );";

   // Limit the range to 0..1 since that is the allowable range for sound volumes.range = "0 1";
};

Methods

Fields