A Control
is a screen control with which a user interacts, such
as an input box, a drop-down box, or a straightforward text label.
This interface allows module:ct-element/Styler
s to interact with
the Control
in order to apply visual effects.
Methods
add Class(class Name)
Adds the specified CSS class name to the control. This has no effect if it is already on the element.
Parameters:
Name | Type | Description |
---|---|---|
className |
String | The CSS class name to add to the DOM. |
clear()
Clear the control and returns it to its original state.
clear State()
Clears the state of the control without modifying the displayed value. This is a faster version of clear for when you are going to update the displayed value immediately after clearing.
create Dummy Control Element()
Create a dummy element. To pick up any CSS class changes that the transform might apply at initialization.
disable()
Disables the control. Does nothing if the control has no concept of enabled/disabled.
enable()
Enables the control. Does nothing if the control has no concept of enabled/disabled.
flash(value, duration)
Flashes the control based on the new control value. Does nothing if the control has no concept of flash. Note that this does not write the new value to the control itself, it merely styles the control according to the value.
Parameters:
Name | Type | Description |
---|---|---|
value |
Variant | The new control value. |
duration |
int | The flash duration in milliseconds. |
focus()
Moves the focus to this control. Does nothing if the control has no concept of focus.
get Attributes() → {Map}
Gets the controls attributes
Returns:
A map of attributes.
- Type
- Map
get Class Name() → {string}
Returns the control's class attribute.
Returns:
The class attribute
- Type
- string
get Flash Duration() → {number}
Gets the value of the flash duration.
Returns:
the flash duration.
- Type
- number
get Handlers()
Gets the control type handlers.
get Id() → {integer}
Gets the numeric id of this control.
Returns:
The numeric id of this control.
- Type
- integer
get Value() → {Variant}
Gets the control value from the control.
Returns:
The control value.
- Type
- Variant
is Enabled() → {Boolean}
Determines whether the control is enabled.
Returns:
true if the control is enabled.
- Type
- Boolean
refresh()
Refresh the screen.
remove Class(class Name)
Removes the specified CSS class name from the control. This has no effect if it is not already on the element.
Parameters:
Name | Type | Description |
---|---|---|
className |
String | The CSS class name to add to the DOM. |
remove Flash()
Removes a control's flash.
replace Class(old Class Name, new Class Name)
Replaces the specified CSS class on the control with a new class.
Parameters:
Name | Type | Description |
---|---|---|
oldClassName |
String | The old CSS class to remove. |
newClassName |
String | The new CSS class to add. |
select()
Moves the focus and highlights this control. Does nothing if the control has no concept of focus.
set Id(id)
Sets the id of this control. Called during construction in
ControlFactory.prototype.createControl
.
Parameters:
Name | Type | Description |
---|---|---|
id |
integer | the value of the id to set. |
set Style(style Name, style Value)
Sets the specified style the control's DOM element.
Parameters:
Name | Type | Description |
---|---|---|
styleName |
String | The style name to add to the DOM. |
styleValue |
String | The style value. |
set Value(value)
Sets the control value, which will update the screen. Depending on the renderer type, this will either be a simple string (if the renderer has no streams) or a map with stream names as its keys.
Parameters:
Name | Type | Description |
---|---|---|
value |
Variant | The new control value. |
to String() → {String}
Returns a human-readable string representation of the object, which is useful for debugging.
Returns:
The string representation
- Type
- String