Gadgets > Rogue Wave Views Gadgets > Panes > Adding Panes to Paned Containers
 
Adding Panes to Paned Containers
A paned container is an instance of the IlvPanedContainer class, a subclass of IlvGadgetContainer, to which panes must be added.
This section covers the following topics:
*Creating a Paned Container
*Modifying the Layout of a Paned Container
*Retrieving Panes
*Encapsulating a Paned Container in a View Pane
Creating a Paned Container
When creating a paned container, you must specify its direction (horizontal or vertical). In a vertical paned container, panes are arranged from top to bottom. In a horizontal pane, they are arranged from left to right.
The following code sample creates a vertical paned container as a top view:
IlvPanedContainer* container = new IlvPanedContainer(display,
"Paned Container",
"Paned Container",
IlvRect(0, 0, 500, 500),
IlvVertical);
You can retrieve the specified orientation and modify it using the member functions IlvPanedContainer::getDirection and IlvPanedContainer::setDirection.
Once you have created a paned container, you can add panes to it with the member function IlvPanedContainer::addPane or remove panes from it with removePane.
Modifying the Layout of a Paned Container
If you modify the current layout of a paned container by adding, removing, showing, or hiding panes, you must call the IlvPanedContainer::updatePanes member function to make your changes effective.
container->addPane(pane1);
container->addPane(pane2);
container->addPane(pane3);
container->updatePanes();
Retrieving Panes
You can use the member function IlvPanedContainer::getCardinal to know the number of panes that a given paned container handles.
The IlvPanedContainer::getPane member functions lets you retrieve a pane using its index or using its name.
You can get the index of a specific pane with the IlvPanedContainer::getIndex member function.
Note: Paned containers reference the panes they hold using indexes. However, we strongly recommend that you do not reference panes using their indexes, because these can change for internal reasons. Instead, use the member function IlvPane::setName to identify panes.
Encapsulating a Paned Container in a View Pane
Because the class IlvPanedContainer inherits from IlvGadgetContainer, itself a subclass of IlvView, you can encapsulate a paned container inside a view pane.
Encapsulating a paned container in a view pane allows you to build complex nested pane structures, as shown in Horizontal and Vertical Paned Container and Encapsulated Paned Container.
The following code sample encapsulates a horizontal paned container in a view pane.
First we create the main vertical paned container:
IlvPanedContainer* container = new IlvPanedContainer(display,
"Paned Container",
"Paned Container",
IlvRect(0, 0, 500, 500),
IlvVertical);
Then we create a horizontal paned container and encapsulate it in a view pane:
IlvPanedContainer* innerContainer = new IlvPanedContainer(container,
IlvRect(0, 0, 500,200),
IlvHorizontal);
IlvViewPane* viewPane = new IlvViewPane("ViewPane", innerContainer);
Note: In our example, we have created innerContainer as a subview of container. Although this practice is not mandatory, we strongly recommend that you proceed that way when creating your own applications. If you do not specify container as the parent of innerContainer, it will be reparented when added to container.
The last step consists of adding the view pane to the main paned container:
container->addPane(viewPane);
Note: You can get the view pane that encapsulates a given paned container using the IlvPanedContainer::getViewPane member function. If no view pane encapsulates the paned container, this member function returns 0.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.