Class: tinymce.ui.Control

# tinymce.ui.Control

Namespace | tinymce.ui
Class | Control
Subclasses | Button, Container, ListBox, MenuButton, MenuItem, Separator

This class is the base class for all controls like buttons, toolbars, containers. This class should not be instantiated directly other controls should inherit from this one.

## Public Methods

Method | Defined By
--- | ---
Control(id:String, s:Object) Constructs a new control instance. | Control
destroy():void Destroys the control will free any memory by removing event listeners etc. | Control
isActive():Boolean Returns true/false if the control is disabled or not. | Control
isDisabled():Boolean Returns true/false if the control is disabled or not. | Control
isRendered():Boolean Returns true/false if the control has been rendered or not. | Control
postRender():void Post render event. | Control
remove():void Removes the control. | Control
renderHTML():String Renders the control as a HTML string. | Control
renderTo(n:Element):void Renders the control to the specified container element. | Control
setActive(s:Boolean):void Sets the activated state for the control. | Control
setDisabled(s:Boolean):void Sets the disabled state for the control. | Control
setState(c:String, s:Boolean):void Sets the specified class state for the control. | Control

## Method details

### Controlconstructor

`public function Control(id:String, s:Object)`
Constructs a new control instance.

#### Parameters

id:String | Control id.
s:Object | Optional name/value settings object.

### destroymethod

`public function destroy():void`
Destroys the control will free any memory by removing event listeners etc.

### isActivemethod

`public function isActive():Boolean`
Returns true/false if the control is disabled or not. This is a method since you can then choose to check some class or some internal bool state in subclasses.

#### Returns

Boolean - true/false if the control is disabled or not.

### isDisabledmethod

`public function isDisabled():Boolean`
Returns true/false if the control is disabled or not. This is a method since you can then choose to check some class or some internal bool state in subclasses.

#### Returns

Boolean - true/false if the control is disabled or not.

### isRenderedmethod

`public function isRendered():Boolean`
Returns true/false if the control has been rendered or not.

#### Returns

Boolean - State if the control has been rendered or not.

### postRendermethod

`public function postRender():void`
Post render event. This will be executed after the control has been rendered and can be used to set states, add events to the control etc. It's recommended for subclasses of the control to call this method by using this.parent().

### removemethod

`public function remove():void`
Removes the control. This means it will be removed from the DOM and any events tied to it will also be removed.

### renderHTMLmethod

`public function renderHTML():String`
Renders the control as a HTML string. This method is much faster than using the DOM and when creating a whole toolbar with buttons it does make a lot of difference.

#### Returns

String - HTML for the button control element.

### renderTomethod

`public function renderTo(n:Element):void`
Renders the control to the specified container element.

#### Parameters

n:Element | HTML DOM element to add control to.

### setActivemethod

`public function setActive(s:Boolean):void`
Sets the activated state for the control. This will add CSS classes to the element that contains the control. So that it can be activated visually.

#### Parameters

s:Boolean | Boolean state if the control should be activated or not.

### setDisabledmethod

`public function setDisabled(s:Boolean):void`
Sets the disabled state for the control. This will add CSS classes to the element that contains the control. So that it can be disabled visually.

#### Parameters

s:Boolean | Boolean state if the control should be disabled or not.

### setStatemethod

`public function setState(c:String, s:Boolean):void`
Sets the specified class state for the control.

#### Parameters

c:String | Class name to add/remove depending on state.
s:Boolean | True/false state if the class should be removed or added.