addChild(component, [data_or_index])

Class: Menu. Method inherited from ContainerComponent.

Description:

Adds a child component to this container component.

Parameters:

Name Type Description

component

object

UI Component that can be a child of this component.

[data_or_index]

number | object

Argument to pass some extra data (such as Tab Name to add Panel to Tabs), or index at which to insert the child. By default component is added to the end.

Returns:

Returns an instance of this component for chaining.

Type: this

Examples:

Adding a component at specified index 5

panel.addChild(new CheckBox("Enabled checkbox").position(10, 15), 5); // adds to panel and positions at (10,15) coordinates

Adding a component at specified index

tabs.addChild(new Panel(), {text: "Registration", enabled: true, tooltip: "Create new account", icon: "images/user.png"});

Also See: