Customizing the Tab control

The Tab control has settings for controlling the position and appearance of the tabs. Each tab can have its own label, picture, and background color.

All tabs share the same font settings, which you set on the Tab control’s Font property page.

Pop-up menus and property sheets for Tab controls and tab pages

A Tab control has several elements, each with its own pop-up menu and property sheet. To open the property sheet, double-click or select Properties on the pop-up menu.

Where you click determines what element you access.

Table 7-1: Accessing Tab control elements

To access the pop-up menu or property sheet for a

Do this

Tab control

Right-click or double-click in the tab area of the Tab control.

Tab page

Click the tab to make the tab page active, then right-click or double-click somewhere in the tab page but not on a control on the page.

Control on a tab page

Click the tab to make the tab page active and right-click or double-click the control.

Position and size of tabs

The General tab in the Tab control’s property sheet has several settings for controlling the position and size of the tabs.

Table 7-2: Controlling size and position of tabs

To change

Change the value for

The side(s) of the Tab control on which the tabs appear

Tab Position

The size of the tabs relative to the size of the Tab control

Ragged Right, MultiLine, Fixed Width

The orientation of the text relative to the side of the Tab control (use this setting with caution—only TrueType fonts support perpendicular text)

Perpendicular Text

NoteFixed Width and Ragged Right When Fixed Width is checked, the tabs are all the same size. This is different from turning Ragged Right off, which stretches the tabs to fill the edge of the Tab control, like justified text. The effect is the same if all the tab labels are short, but if you have a mix of long and short labels, justified labels can be different sizes unless Fixed Width is on.

This figure illustrates the effect of combining some of these settings. Tab Position is Top:

The tabs run across the top of each of the five examples shown here. The first has tabs with ragged right and perpendicular text both on. The tabs here bunch to the left and the text runs from bottom to top. The second example, ragged right off and perpendicular text on, sizes the tabs out evenly to fill the space. The third, ragged right off with multiline on, displays horizontal tabs in two lines, with text left-justified. The fourth, ragged right and multiline both on, displays two lines of horizontal tabs sized to fit the text. The last, multiline off with ragged right at any setting, displays one line of horizontal tabs sized to fit the text.

This sample Tab control is set up like an address book. It has tabs that flip between the left and right sides. With the Bold Selected Text setting on and the changing tab positions, it is easy to see which tab is selected:

The sample Tab control shows a page of employees listed alphabetically. Tabs running along the upper left and lower right of the list offer ranges of letters such as a through c that the user can select to display a different page of the list. The last tab on the left is the one selected. Its range of letters is bolded. The ones that follow it are displayed on the right.

Tab labels

You can change the appearance of the tab using the property sheets of both the Tab control and the Tab page.

Table 7-3: Changing the appearance of a tab

Property sheet

Property page

Setting

Affects

Tab control

General

PictureOnRight, ShowPicture, ShowText

All tabs in the control

Tab page

General

Text, BackColor

The label on the tab and the background color of the tab page

Tab page

TabPage

PictureName, TabTextColor, TabBackColor, PictureMaskColor

The color of the text and picture on the tab and the background color of the tab itself (not the tab page)

If you are working in the User Object painter on an object you will use as a tab page, you can make the same settings on the TabPage page of the user object’s property sheet that you can make in the tab page’s property sheet.

This example has a picture and text assigned to each tab page. Each tab has a different background color. The Show Picture and Show Text settings are both on:

Three tabs display horizontally, each with an icon and a word to indicate the tab’s function, such as the word Query and a picture of binoculars.

Changing tab appearance in scripts

All these settings in the painter have equivalent properties that you can set in a script, allowing you to change the appearance of the Tab control dynamically during execution.