Understanding tab set processing
The tab set processing functions in Toolkit enable you to associate windows or lists with the “tabs” of a tabbed dialog. Specific input window or list processing is handled using a method that you register with Toolkit.
The basic tab set functionality is as follows:
- A tab is associated with a window (or list) and a method, and is contained within a tab set. The associated window is placed immediately below (or beside) the set of tabs, and appears to be joined to its associated tab.
- When the tab is selected (with a menu entry or mouse click), the associated window (or list) is brought to the front, and the associated method routine is invoked.
- The entire set of tabs and windows is contained within a bounding window, which may also contain buttons.
A tab set is created with a call to %TS_TABSET using the DTS_CREATE subfunction. (Windows are added to the tab set with the DTS_WINDOW subfunction; lists are added with DTS_LIST.) The window or list is visually transformed into a tab page. It is placed adjacent to the tabs, a tab is created for it, and the border is rendered in a manner compatible with a tabbed page. On Windows, this is a blended 3-D effect.
On Unix and OpenVMS, the top border of the window will be overlapped by a single-line window containing textually rendered tabs:
/Tab one \/Tab two \/ Tab three \
Slashes are used to delimit the tabs, by default, and the underscore attribute is used to distinguish the inactive tabs from the active one. See the DTS_CREATE, DTS_SELECT_ATTR, and DTS_NONSELECT_ATTR subfunctions of %TS_TABSET for information on how to modify these separators and attributes.
By default, tabs are placed at the top of the tab set. You can change this by setting DTS_BOTTOM, DTS_VERTICAL, or DTS_RIGHT when creating a tab set. (Note, however, that for Windows, we recommend leaving tabs at the top of the tab set; DTS_BOTTOM and DTS_VERTICAL result in incorrectly drawn tabs.)
The text of the tab is the text of the window’s title, if any. Subsequently, the placement of the window is left at the discretion of the tab set.
If the size of the window or list is larger than the number of rows and columns specified for the tab set on DTS_CREATE, by default the window or list will be clipped. If a resize event is specified for the window or list, scroll bars will be displayed as necessary.
The order in which windows are added to the tab set defines the ordering of the tabs. Only one row of tabs will be displayed. If this is not sufficient to display all the tabs in the tab set, on Windows, scroll bars are used by default to indicate that more tabs exist. This style can be changed to use multi-line tabs instead of scroll bars by using the DTS_MULTILINE option when creating a tab set. On Unix and OpenVMS systems, the active tab will always be visible.
A tab can be brought to the front programmatically by using the DTS_ACTIVE subfunction of %TS_TABSET.
To process a tab set, call %TS_PROCESS. When this routine is called, the method for the active tab is immediately invoked. When a tab switch occurs within %TS_PROCESS, the associated window is brought to the front, and its associated method is called. The only time that %TS_PROCESS returns is when a menu entry is selected that is not recognized by the currently active tab’s method, nor by %TS_PROCESS.
To remove a tab from a tab set, use DTS_REMOVE. The user won’t see the tab on the tab set, but the window will still reside in memory. You must use U_WINDOW with D_DELETE (or rely on an environment) to remove a window from memory.
To delete a tab set, do one of the following:
- Let an environment delete the tab set for you. By default the tab set container window is local to the current environment, so if you create and load the windows and tab set in an environment, Toolkit will delete the tab set and remove all the tab set windows from memory when you exit the environment.
- Use U_WINDOW with the D_DELETE operation. You can do this because a tab set container is a Toolkit window. (To use D_DELETE, you’ll need to pass the window ID that was returned when the tab set was created.) However, individual tab windows (input windows, lists, and ActiveX containers) will not be deleted when you delete the tab set container window. You’ll need to use U_WINDOW with D_DELETE to delete each of the individual tab windows (use L_DELETE for lists) after you delete the tab set container window.