Search
Control.attach Method
See Also
 






Attach control event handlers.

Namespace: MindFusion.Common
File: Control.js

 Syntax

JavaScript  Copy Code

function attach ()

 Remarks

The attach method attaches the event handlers of a UI element. It is used when creating UI controls dynamically in code.

 Example

The following code uses the attach method in a method that creates a ToolStrip programmatically:

JavaScript  Copy Code

function loadChatWindow(sender)
{
 var tools = new ui.ToolStrip();
 tools.theme = theme;
 tools.scrollable = false;
 tools.allowDrag = false;
 tools.itemClick.addEventListener(onToolClick);

 button = new ui.ToolStripItem(ui.ToolStripItemType.Icon);
 button.imageSrc = "./images/icon_home.png";
 button.tooltip = "home";
 tools.items.add(button);
 .......................................
 ........................................
 sender.element.querySelector("#toolstrip").appendChild(tools.draw());
 tools.attach();
}

 See Also