|SAS/AF Software: Class Dictionary|
A tab layout consists of a set of partitions and tabs. A single tab is "attached" to each partition, much like a tab divider can be attached to a page in a notebook. The tabs are arranged in a row or rows, typically along the top or left side of the collection of partitions. A client area exists within each partition, and a client object can occupy this client area. By default, this client object is a container box which can contain other widgets.
You can think of the rows of tabs like folders arranged in a stack or dividers in a notebook. Only one tab (or "folder") is active at a time, and this active tab appears as a raised tab in the top-most folder. The tab layout manages the display of the client areas, so when a user selects a tab, the client objects assigned to that tab's client area display while the client objects associated with all other tabs remain hidden.
|Creating a Tab Layout|
To create a tab layout object:
Tabsattributes tab to determine the number of tabs, and specify labels for tabs.
Advancedtab to specify additional attributes as necessary.
At run time, users of your application select a tab to access the control and/or data entry widgets in that tab's client area.
|Using Tab Groups|
A single group of tabs covers the needs of most applications. However, some situations may require keeping sets of tabs separate from other tabs. For example, imagine that you have a stack of folders of information for a company and its subsidiaries. If you only needed to look at information in the folders for one subsidiary, you would place all of its folders in a group on top of the stack and work with them, leaving the other folders stacked below them on your desktop.
The Tab Layout class handles these association requirements through groups of tabs. A group is a set of logically-related tabs. Tabs in a group appear together and never occupy the same row as tabs in other groups. You can maintain visual differences between tab groups by specifying group color, group spacing, or group indention. (See _setTabs, _setGroupIndention, and _setGroupSpacing for more information.)
|Advanced Uses of the Tab Layout Class|
There are two ways of implementing a tab layout:
There are three primary ways of creating a tab layout:
Suppose that you want to use a tab layout object to allow the user to view any one of three text files (a task list, a work schedule, and a project plan), depending on which tab is selected. To implement this file viewer, you create a tab layout object with three tabs, labeled "Tasks," "Schedule," and "Plan," and a single client object containing an external file viewer object. When a user changes tabs, you change the file with which the viewer is associated.
There are two ways to handle the detection of user tab selection: querying
the tab layout under its object label, or trapping events.
Interactive selection of a tab runs the object label section of your SCL, where you can notify the external file viewer to display the correct file.
Your SCL should look like this:
init: /* define the array of filenames to */ /* correspond to tab ids */ array tabfiles $8 ("tasklist","workschd", "cafemenu"); return; tabber: /* processing a user's single-click */ /* selection */ if _status = " " then do; /* determine which tab is selected */ call notify ('tabber', '_getActiveTab', id); call notify ('viewer', '_setFile', tabfiles[id], 'n'); end; return;
Interactive selection of a tab generates a sequence of events to keep your application apprised of the current tab and group. If your tab layout object has tabs arranged in groups, it will generate group events when a tab is selected in a group other than the currently- active group. If there are no groups, or the new tab is in the same group as the previously-active tab, the tab layout will not generate group events.
The events occur in the following order:
|GROUP DESELECTED (if appropriate)|
|GROUP SELECTED (if appropriate)|
Your frame SCL should look like this:
init: call notify ('viewer', '_setInstanceMethod', '_newFile', 'lib.cat.viewer.scl', 'newfile'); call notify ('viewer', '_setEventHandler', 'tabber', 'TAB SELECTED','_newFile', 'viewer'); return;
and lib.cat.viewer.scl should look like this:
array tabfiles $8 ("tasklist", "workschd", "cafemenu"); newfile: method tabid 8; call send (_self_, '_setFile', tabfiles[tabid], 'n'); endmethod;
Several of the methods accept a unit of measure parameter. The following table lists the valid units and provides a definition:
Name Description in inches cm centimeters mm millimeters pt points pc picas el l-space (one-third the width of an em) em the width of a piece of type about as wide as it is tall; usually 1 ln in the x-direction en n-space (half the width of an em) ex x-space (height of the x-character) fg figure width (width of the zero- character) sp space (width of the space-character) cc width of the widest character in the font ht height of the tallest character in the font dp depth of the deepest character in the font ln line space (1ht + 1dp) px x-pixels py y-pixels
Font dependent units (el, em, en, ex, fg, sp, cc, ht, dp, ln) are calculated
using the label font. Whenever the label font changes (see _setLabelFont),
the font dependent units are recalculated.
The Tab Layout class generates four events to keep your application apprised of the current active tab and group. To receive these events, use the Object class method _setEventHandler. Refer to the _setEventHandler method for details.
Your method should accept a single numeric parameter for the identifier of the group that was deselected.
Your method should accept a single numeric parameter for the identifier of the group that was selected.
Your method should accept a single numeric parameter for the identifier of the tab that was deselected.
Your method should accept a single numeric parameter for the identifier of the tab that was selected.
See Trapping Events for an example of tab layout event handling.
Top of Page
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.