Use the Stack Layout nodes to arrange nodes next to each other on the selected axis. You can set the direction and the starting point for arranging Stack Layout 3D child nodes on x, y, and z axes, and Stack Layout 2D child nodes on x and y axes.
To create a Stack Layout node:
(Optional) To clear the area around child nodes in a layout, in the Project select child nodes in the layout, in the Properties click , and add and set the margin properties:
To reverse the order of child nodes in a Stack Layout node, in the Project select the Stack Layout node for which you want to reverse the order of child nodes and in the Properties enable the Reversed property.
Use brushes to set the background of 2D nodes. In Kanzi all 2D nodes by default have transparent background.
To set the background:
To create a Stack Layout 3D object:
// Create a Stack Layout 3D object named Stack. StackLayout3DSharedPtr stack = StackLayout3D::create(domain, "Stack");
To control the direction of a stack layout:
// Set the stack layout to arrange its items along the x axis. stack->setDirection(StackLayout3D::DirectionX);
To add items to a stack layout:
// Stock Layout 3D arranges its items in the order you add them. // Create a 3D object and ... Model3DSharedPtr item1 = Model3D::createBox(domain, "item1", 1.3f, 1.3f, 1.3f, KanziThemeRed); // ... add it to the stack layout. stack->addChild(item1); Model3DSharedPtr item2 = Model3D::createSphere(domain, "item2", 0.8f, 30, 30, KanziThemeGreen); stack->addChild(item2); Model3DSharedPtr item3 = Model3D::createBox(domain, "item3", 1.0f, 1.0f, 1.0f, KanziThemeBlue); stack->addChild(item3);
To reverse the order in which a stack layout arranges its items:
// Set the stack layout to arrange its items in the reverse order. stack->setReversed(true);
For details, see the API reference.
To create a Stack Layout 2D object:
// Create a Stack Layout 2D object named Stack. StackLayout2DSharedPtr stack = StackLayout2D::create(domain, "Stack");
To control the direction of a stack layout:
// Set the stack layout to arrange its items along the x axis. stack->setDirection(StackLayout2D::DirectionX);
To add items to a stack layout:
// Stock Layout 2D arranges its items in the order you add them. // Create a 3D object ... EmptyNode2DSharedPtr item1 = EmptyNode2D::create(domain, "item1", 100.0f, 100.0f, KanziThemeRed); // ... and add it to the stack layout. stack->addChild(item1); EmptyNode2DSharedPtr item2 = EmptyNode2D::create(domain, "item2", 100.0f, 100.0f, KanziThemeGreen); stack->addChild(item2); EmptyNode2DSharedPtr item3 = EmptyNode2D::create(domain, "item3", 100.0f, 100.0f, KanziThemeBlue); stack->addChild(item3);
To reverse the order in which a stack layout arranges its items:
// Set the stack layout to arrange its items in the reverse order. stack->setReversed(true);
For details, see the API reference.