Chapter 18. TabPanels

A TabPanel is a built-in control class for showing alternate sets of controls within a window. It displays itself as a rectangular region, at one edge of which there appears a series of text captions (the tabs). When the user clicks on one of the tabs, the set of controls within the TabPanel region is replaced by a different set of controls. Figure 18-1 shows an example.

A TabPanel
Figure 18-1. A TabPanel

What’s actually happening here is that REALbasic is simply turning one set of controls invisible and another set of controls visible. This is nothing that you couldn’t do yourself, in code; however, use of a TabPanel has two advantages:

  • The task of maintaining entire sets of controls, turning them all visible and invisible appropriately, is handled automatically by REALbasic.

  • The user is presented with a convenient and familiar interface for requesting that the set of visible controls be changed.

On Windows, a TabPanel can receive the focus, and the user can then use arrow keys to switch between its tabs. See Section 13.3.

Preparation

Preparation of a TabPanel in the IDE, once it has been dragged into a Window Editor, is a two-stage process. First, click on the blank tab (the one containing the ellipsis mark) to bring up the Tab Panel Editor dialog. This is where you create new captions, set the text of captions, and change their order. When you’re done, you’ll have as ...

Get REALBasic: TDG, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.