Table of Contents
ColorDialog
This object represents a window allowing the user to choose a color.
Functions
ColorDialog
Constructor function.
Syntax
var myObject = new ColorDialog();
var myObject = new ColorDialog(parameters);
Arguments
- parameters - (object) window parameters
- title - (string) the window's title
- position - (Point) the window's position
- opacity - (float) the window's opacity
- enabled - (boolean) the window's enabled status
- visible - (boolean) the window's visible status
- showAlphaChannel - (boolean) show the alpha channel
- color - (Color) the selected color
- onClosed - (OnClosed) the OnClosed event
- onColorSelected - (OnColorSelected) the OnColorSelected event
- onColorChanged - (OnColorChanged) the OnColorChanged event
Exceptions
- (ParameterTypeError) incorrect parameter type
- (ParameterCountError) incorrect parameter count
Example
var myObject = new ColorDialog();
var myObject = new ColorDialog({ title: "My title", opacity: 0.5 });
Methods
setTitle
Sets the window's title.
Syntax
myObject.setTitle(title);
Arguments
- title - (string) the window's title
Returns
- (ColorDialog) this ColorDialog
setPosition
Sets the window's position.
Syntax
myObject.setPosition(point);
Arguments
- point - (Point) the window's position
Returns
- (ColorDialog) this ColorDialog
setOpacity
Sets the window's opacity.
Syntax
myObject.setOpacity(opacity);
Arguments
- opacity - (float) the window's opacity
Returns
- (ColorDialog) this ColorDialog
setEnabled
Sets the window's enabled status.
Syntax
myObject.setEnabled(enabled);
Arguments
- enabled - (boolean) the window's enabled status
Returns
- (ColorDialog) this ColorDialog
setVisible
Sets the window's visible status.
Syntax
myObject.setVisible(visible);
Arguments
- visible - (boolean) the window's visible status
Returns
- (ColorDialog) this ColorDialog
close
Closes the window.
Syntax
myObject.close();
Returns
- (ColorDialog) this ColorDialog
title
Returns the window's title.
Syntax
myObject.title();
Returns
- (string) the window's title
position
Returns the window's position.
Syntax
myObject.position();
Returns
- (Point) the window's position
opacity
Returns the window's opacity.
Syntax
myObject.opacity();
Returns
- (float) the window's opacity
enabled
Returns the window's enabled status.
Syntax
myObject.enabled();
Returns
- (boolean) the window's enabled status
visible
Returns the window's visible status.
Syntax
myObject.visible();
Returns
- (boolean) the window's visible status
showAlphaChannel
Sets if the alpha channel should be visible.
Syntax
myObject.showAlphaChannel(showAlphaChannel);
Arguments
- showAlphaChannel - (boolean) the alpha channel visibility status
Returns
- (ColorDialog) this ColorDialog
setColor
Sets the current color.
Syntax
myObject.setColor(color);
Arguments
- color - (Color) the current color
Returns
- (ColorDialog) this ColorDialog
show
Show the window. (non-blocking) Use the OnClosed event to know when the window has been closed.
Syntax
myObject.show();
Returns
- (ColorDialog) this ColorDialog
showModal
Show the window. (blocking)
Syntax
myObject.showModal();
Returns
- (integer) the window result (0 means that it has been canceled)
color
Returns the current color.
Syntax
myObject.color();
Returns
- (Color) the current color
Events
onClosed
Called when the window is closed.
Syntax
myObject.onClosed = function(result) {};
Arguments
- result - (integer) the window result (0 means that it has been canceled)
Example
myObject.onClosed = function(result) { if(result) { //Event action } };
onColorSelected
Called when a color has been selected.
Syntax
myObject.onColorSelected = function(color) {};
Arguments
- color - (Color) the selected color
Example
myObject.onColorSelected = function(color) { //Event action };
onColorChanged
Called when the current color has been changed.
Syntax
myObject.onColorChanged = function(color) {};
Arguments
- color - (Color) the current color
Example
myObject.onColorChanged = function(color) { //Event action };
Attributes
title
The window's title. (string)
position
The window's position. (Point)
opacity
The window's opacity. (float)
enabled
The window's enabled status. (boolean)
visible
The window's visible status. (boolean)