Method

SelectColor


Warning

This item was deprecated in version 2019r2. Please use Color.SelectedFromDialog as a replacement.

Description

Displays the system Color Picker, allowing the user to choose a color.

Usage

result = SelectColor(ByRef col, prompt)

Part

Type

Description

result

Boolean

Returns True if the user clicks OK; False if the user cancels.

col

Color

Color passed to SelectColor and the color the user selects.

prompt

String

Prompt to be displayed in the Color Picker. Shown only on Linux.

Notes

You control the default choice of color displayed by the Color Picker by passing a value of col to SelectColor. If col is not assigned a value, black is used as the default color. The color that the user chooses is returned in col. If the user clicks Cancel without making a choice, result is set to False; otherwise it is set to True.

Sample code

The following example allows the user to select a color that will be used as the fillcolor in a Rectangle control.

Dim c  As Color
Dim b As Boolean
c = CMY(0.35, 0.9, 0.6) ' choose the default color shown in color picker
b = SelectColor(c, "Select a Color")
Rectangle1.FillColor = c

If you don't want to test the boolean returned by SelectColor, you can call it using Call.

Call SelectColor(c, "Select a Color")

Compatibility

All project types on all supported operating systems.

See also

Color data type; Color.CMY, Color.RGB, Color.HSV functions; &c literal.