[Containers] Panel
Adding A Panel
Drag a Panel from the Widgets section onto the middle canvas.

Selecting The Panel
You can select the Panel if it isn't already selected from the Animation Editor at the bottom. The Panel doesn't appear in the resources as it's part of the Scene or other object that you are using.
Panels are used as a way of grouping objects together. To add objects to your panel you simply drag any object onto the panel. All transformations applied to the Panel will affect it's children as well.

Modifying The Panel
You can change the Panel background file. Setting the Panel's background file can be done by double clicking on the section or dragging an image from the Resources section.

Accessing The Panel In Code
Panel's can be accessed via their Name or Tag which can be set in the Properties section.

To access the Panel from a scene for example, in code it is simple. You either access it as a Node or cast it to a Panel allowing you to use Panel methods along with Node methods.
Node *rootNode = CSLoader::createNode( "Filepath to .csb file" );
this->addChild( rootNode );
// panel accessed as a node using it's name
Node *panel = rootNode->getChildByName( "Name set in Cocos Studio" );
// panel cast to a panel using it's name
cocos2d::ui::Layout *panel = ( cocos2d::ui::Layout * )rootNode->getChildByName( "Name set in Cocos Studio" );
// panel accessed as a node using it's tag
Node *label = rootNode->getChildByTag( 5 );
// panel cast to a panel using it's tag
cocos2d::ui::Layout *panel = ( cocos2d::ui::Layout * )rootNode->getChildByTag( 5 );
var rootNode = ccs.load( "Filepath to .json file" );
this.addChild( rootNode.node );
// get the panel by name
var panel = rootNode.node.getChildByName( "Name set in Cocos Studio" );
// get the panel by tag
var panel = rootNode.node.getChildByTag( 5 );
Note: Cocos2d-JS doesn't require casting to use Panel methods.
Updated 4 months ago