Defining and managing tab pages
A tab page is a user object.
Two methods
There are different ways to approach tab page definition.
You can define:
- An embedded
tab page In the painter, insert tab pages in the Tab control and add
controls to those pages. An embedded tab page is of class UserObject,
but is not reusable. - An independent user object In the User Object painter, create a custom visual user object
and add the controls that will display on the tab page. You can
use the user object as a tab page in a Tab control, either in the painter
or by calling OpenTab in a script. A tab page defined as an independent
user object is reusable.
You can mix and match the two methods—one Tab control
can contain both embedded tab pages and independent user objects.
Creating tab pages
When you create a new Tab control, it has one embedded tab
page. You can use that tab page or you can delete it.
To create a new tab page within the Tab control:
-
Right-click in the tab area of the Tab
control. Do not click a tab page. -
Select Insert TabPage from the pop-up menu.
-
Add controls to the new page.
To define a tab page independent of a Tab control:
-
Select Custom Visual on the Object tab
in the New dialog box. -
In the User Object painter, size the user object
to match the size of the display area of the Tab control in which
you will use it. -
Add the controls that will appear on the tab page
to the user object and write scripts for their events. -
On the user object’s property sheet,
click the TabPage tab and fill in information to be used by the
tab page.
To add a tab page that exists as an independent
user object to a Tab control:
-
Right-click in the tab area of the Tab
control. Do not click a tab page. -
Select Insert User Object from the pop-up menu.
-
Select a user object.
The tab page is inherited from the user object you select.
You can set tab page properties and write scripts for the inherited
user object just as you do for tab pages defined within the Tab
control.Editing the controls on the tab page user object You cannot edit the content of the user object within the
Tab control. If you want to edit or write scripts for the controls,
close the window or user object containing the Tab control and go
back to the User Object painter to make changes.
Managing tab pages
You can view, reorder, and delete the tab pages on a Tab control.
To view a different tab page:
-
Click the page’s tab.
The tab page comes to the front and becomes the active tab
page. The tabs are rearranged according to the Tab position setting
you have chosen.
To reorder the tabs within a Tab control:
-
Click the Page Order tab on the Tab control’s
property sheet. -
Drag the names of the tab pages to the desired
order.
To delete a tab page from a Tab control:
-
Click the page’s tab.
-
Right-click the tab page and select Cut or Clear
from the pop-up menu.
Selecting tab controls and tab pages As you click on various areas within a tab control, you will
notice the Properties view changing to show the properties of the
tab control itself, one of the tab pages, or a control on a tab
page. Before you select an item such as Cut from the pop-up menu,
make sure that you have selected the right object.
Clicking anywhere in the tab area of a tab control selects
the tab control. When you click the tab for a specific page, that
tab page becomes active, but the selected object is still the tab
control. To select the tab page, click its tab to make it active
and then click anywhere on the background of the page except on
the tab itself.
Controls on tab pages
The real purpose of a Tab control is to display other controls
on its pages. You can think of the tab page as a miniature window.
You add controls to it just as you do to a window.
When you are working on a Tab control, you can add controls
only to a tab page created within the Tab control.
Adding controls to an independent user object tab page To add controls to an independent user object tab page, open
it in the User Object painter.
To add a control to an embedded tab page:
-
Choose a control from the toolbar or the
Insert menu and click the tab page, just as you do to add a control
to a window.When you click inside the tab page, the tab page becomes the
control’s parent.
To move a control from one tab page to another:
-
Cut or copy the control and paste it on
the destination tab page.
The source and destination tab pages must both be embedded
tab pages, not independent user objects.
To move a control between a tab page and the window
containing the Tab control:
-
Cut or copy the control and paste it on
the destination window or tab page.You cannot drag the control out of the Tab control onto the
window.
Moving the control between a tab page and the window changes
the control’s parent, which affects scripts that refer
to the control.