A Tab control is a container for tab pages that display other controls. You can add a Tab control to a window in your application to present information that can logically be grouped together but might also be divided into distinct categories. An example is the use of tab pages in the Properties view for objects in PocketBuilder.
When you add a Tab control to a window, PocketBuilder creates a Tab control with one tab page labeled “none”. The control is rectangular. By default, the tab label is at the bottom of the tab page.
Typically you use more than one tab page on a tab control. After you add a tab control with a single tab page to a window, you add as many tab pages as your application requires.
Each tab page displays a label that is visible even when a different tab page is selected. If the number of tab pages is too large to display all the tab pages, a miniature scroll bar is displayed on the screen at the level of the visible tab labels. The scroll bar enables users to scroll to hidden tab labels.
To select the Tab control at design time, click any of the tab labels, or click in the area adjacent to the tab labels but outside the current tab page.
To select a tab page, click its label and then click anywhere on the tab page except the label itself. Selection handles display at the corners of the tab page, but do not include the tab control labels. (When the tab control is selected rather than the tab page, the selection handles include the tab control labels.)
You can add a new Tab control to a window by selecting Insert>Control>Tab and clicking in the window. The control has one tab page when it is created. Use the following procedure to place additional tab pages in the tab control.
To create a new tab page in a Tab control:
Select the Tab control by clicking on a tab label or in the area to the right of the labels when the labels display at the bottom or top of the tab pages.
The handles that indicate that the Tab control is selected display at the corners of the Tab control. If you selected the tab page, the handles display at the corners of the area above the tab labels when the labels are at the bottom of the control.
The pop-up menu for a tab page does not allow you to insert additional tab pages, only to modify the order of the controls on the selected tab.
Choose Insert TabPage from the pop-up menu.
Add controls to the new tab page.
You can create reusable tab pages in the User Object painter by defining a tab page with controls on it that is independent of a Tab control. You can then add that tab page to one or more Tab controls.
To define a tab page that is independent of a Tab control:
Click the New button on the PowerBar and use the Custom Visual icon on the Object tab page to create a custom visual user object.
Size the user object to match the size of the Tab controls in which you will use it.
To the user object, add the controls that you want to display on the tab page.
Select the user object (not one of the controls you added) and on the TabPage page in the Properties view, specify the information to be used by the tab page:
Text—The text to display on the tab
PictureName—A picture to display on the tab with or instead of the text
PowerTipText—Text for a pop-up message to display when the user moves the cursor to the tab
Colors for the tab and its text
Save and close the user object.
After you have created a user object that can be used as a tab page, you can add it to a Tab control. You cannot add the user object to a Tab control if the user object is open. After you have added the user object to the control, you also cannot open the user object and the window that contains the Tab control at the same time.
To add a tab page that exists as an independent user object to a Tab control:
In the Window painter, right-click the Tab control.
Choose Insert User Object from the pop-up menu.
Select a user object that you have set up as a tab page and click OK.
A tab page, inherited from the user object you selected, is inserted. You can select the tab page, set its tab page properties, and write scripts for the inherited user object just as you do for tab pages defined within the Tab control, but you cannot edit the content of the user object within the Tab control. If you want to edit the controls, close the Window painter and go back to the User Object painter to make changes.
You can use the Layout view to open other views of the Tab control and to move, resize, or delete the Tab control.
To change the name and properties of the Tab control:
Click any of the tabs in the Tab control to display the Tab control properties in the Properties view.
Edit the properties.
For more information, right-click in the Properties view and select Help from the pop-up menu.
To change the scripts of the Tab control:
Double-click one of the tab labels or right-click a tab label and select Script from the pop-up menu.
Select the Tab control event you want from the second drop-down list of the Script view and edit the script.
To move a Tab control:
With the mouse pointer on one of the tab labels, hold down the left mouse button and drag to move the control to the new position
The Tab control and all tab pages are moved as a group.
To resize a Tab control:
Grab a border of the control and drag it to the new size
The Tab control and all tab pages are sized as a group.
To delete a Tab control:
With the mouse pointer on one of the tabs, select Cut or Delete from the pop-up menu
You can use the Layout view to display any tab page in a Tab control, to open other views of the selected tab page, and to delete the selected tab page from the Tab control.
To view a different tab page:
Click on the label for the tab page you want to view
The selected tab page is brought to the front. The tabs are rearranged according to the TabPosition setting you have chosen for the Tab control.
To change the name and properties of a tab page:
Select the tab.
Selecting a tab can move it to the position for a selected tab based on the TabPosition setting for the Tab control. For example, if TabPosition is set to tabsonbottomandtop! and a tab displays at the top, it moves to the bottom when you select it.
Click anywhere on the tab page except the tab label.
Edit the properties.
To change the scripts of the tab page:
Select the tab.
It may move to the position for a selected tab based on the Tab Position setting for the Tab control.
Click anywhere on the tab page except the tab label.
Select Script from the tab page’s pop-up menu.
Select a script and edit it.
To delete a tab page from a Tab control:
With the mouse pointer anywhere on the tab page except the tab label, select Cut or Delete from the pop-up menu
You can add and move controls on tab pages the same way you add and move controls on a window.
To add a control to a tab page:
Choose a control from the toolbar or the Control menu, then click in the tab page where you want to add the control
You can add controls only to a tab page created within the Tab control. To add controls to an independent tab page, open it in the User Object painter.
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 be embedded tab pages, not independent ones created in the User Object painter.
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
Moving the control between a tab page and the window changes the control's parent, which affects scripts that refer to the control.
For more information on the Tab control, see the chapter on using tab controls in the Resource Guide.