MAXScript Tools and Interaction with 3ds Max > Creating MAXScript Tools > Scripted Utilities and Rollouts > Rollout User-Interface Controls > Rollout User-Interface Controls Types >

# Slider UI Control

User Interface Controls > Common Properties > Layout > Types > Slider

| Creating User Interfaces - Quick Navigation

A slider control is used to place a slider on the rollout, as an alternative to a spinner. The user can drag the slider's pointer around to set its value.

The syntax is:

    slider <name> [<caption>] [range:[min,max,val]] [type:<#float |	#integer>] [ticks:10][orient:<#horizontal |	#vertical>][controller:(<controller>)] [toolTip:<string>]

The default alignment of slider items is #center .

EXAMPLE:
    slider tilt "Head tilt" orient:#vertical ticks:0 range:[-30,30,0]
    on tilt changed val do $head.bend.angle = val

Parameters:

    range:

A Point3 value containing the minimum, maximum and initial values for the slider in the x, y, and z components, respectively. Defaults to [0,100,0].

    type:

The type of the slider, #float or #integer . Defaults to #float .

    orient:

The layout orientation of the slider in the rollout, either #vertical or #horizontal . Defaults to #horizontal .

    ticks:

Specifies how many ticks to place along the slider bar. No ticks are drawn if you specify ticks:0 . Defaults to 10.

    controller:

Links the slider to the specified controller. This can be a new controller or 'undefined' to disconnect. This lets you establish a direct link between the slider and the controller. Changes to the slider will automatically update the controller (and its controlled objects). Changes to the controller automatically update the slider. This feature was previously available for spinner controls only. Available in 3ds Max 8 and higher.

    tooltip:

Specifies the tooltip text to be displayed when the mouse hovers over the slider.

Available in 3ds Max 2010 and higher.

Properties:

    <slider>.range Point3

The current range and value for the slider, as a Point3 like the range: parameter.

    <slider>.value Float

The current value of the slider.

    <slider>.ticks Integer

The number of ticks along the slider.

    <slider>.tooltip String

Get/set the tooltip text to be displayed when the mouse hovers over the slider.

Available in 3ds Max 2010 and higher.

Events

    on <slider> changed <arg> do <expr>

Called when the user moves the slider pointer. The <arg> argument contains the new value of the slider.

    on <slider> rightClick do <expr>

Called when the Slider control is right-clicked.

Available in 3ds Max 2010 and higher.

    on <slider> buttondown do <expr>

Called when the user first clicks the slider.

    on <slider> buttonup do <expr>

Called when the user releases the slider.

The buttonDown and buttonUp events effectively notify you of the start and end of a slider "twiddle", allowing you to perform some setup for the adjustment. A typical use for this is to bring scene nodes that are being modified in the on <slider> changed handler into the foreground plane to speed up screen redraw.

EXAMPLE:
    slider foo "height: "
    on foo buttonDown do flagForeground $baz...* true
    on foo buttonUp do flagForeground $baz...* false

NoteIf you are using a slider to interactive adjust a property of an on-screen object, you can improve the interactive speed by moving the object to the foreground plane. Objects placed in the foreground plane are redrawn individually and so interactive changes to them are much faster. An object is moved to the foreground or background plane using the flagForeground() method described below:

    flagForeground <node> <boolean> -- mapped

The boolean argument puts the scene node(s) into the foreground plane if true , or into the background plane if false .

You should be judicious in putting objects in the foreground plane, because putting too many objects in the foreground plane reduces the foreground plane's effectiveness. Remember to return objects to the background plane when you don't need to interactively control them any more.

#### See Also

- Rollout User-Interface Items Common Properties

- Rollout User-Interface Items Common Layout Parameters

- Rollout User-Interface Control Types

- Similar Controls

- ProgressBar

- Spinner

- Angle

- Curve Control

- Colorpicker