Colorpicker UI Control

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

 

   

Creating User Interfaces - Quick Navigation

A colorpicker control is used to place a 3ds Max color selection swatch on the rollout. The user can click the swatch to display a Color Selector dialog or drag colors to or from it.

The syntax is:

colorpicker <name> [ <caption> ] [color:<color>] [alpha:<boolean>] [fieldWidth:<number>] [height:<number>] [modal:<boolean>] [title:<string>]

The default alignment of colorpicker items is #left .

EXAMPLE:

rollout change_wirecolor "Object Color Changer"
(
  colorpicker theColor "Wireframe color:" color:[0,0,255] modal:false
  on theColor changed new_col do selection.wirecolor = new_col
)
createDialog change_wirecolor

In this example, the color picker is set to non-modal, which means that changing the color value will change the wireframe color of all selected objects instantly and interactively. Setting modal: to true would let the user adjust the color without feedback in the viewports and assign the result using the OK button.

   

Parameters:

color:

Initial color of the swatch. Defaults to blue.

   

title:

The title displayed on the Color Selector dialog. Defaults to "Choose a color".

   

fieldWidth:

The width in pixels of the swatch. Defaults to 40.

   

height:

The height in pixels of the swatch. Defaults to 16.

   

modal:

By default, the color picker is declared as modal which prevents key strokes from being passed to 3ds Max. When the keyword argument modal: is set to false , the color picker will enable the shortcuts.

   

alpha:

When set to true , clicking the color swatch brings up the color picker with alpha support. Defaults to false . If the color swatch is tied to an #acolor of #point4 parameter, this parameter is automatically set to true . Available in 3ds Max 6 and higher.

   

Properties

<colorpicker>.color Color

The current swatch color.

   

<colorpicker>.alpha Boolean

When set to true , clicking the color swatch brings up the color picker with alpha support.(Previously available in 3ds Max 6 as construction parameter only).

   

Events

on <colorpicker> changed <arg> do <expr>

Called when the user selects a new color in the open Color Selector dialog for this swatch or drops a new color on it. The <arg> argument contains the newcolor.

   

See Also