Programming Guide |
Activates a window
int sm_wselect(int window_number);int sm_n_wselect(char *window_name);
window_number
- Specifies the window to activate, where
window_number
is its zero-based offset in the window stack. Windows are numbered sequentially from the bottom of the stack, where the bottom-most screen, or base window, is 0. Callingsm_wselect
changes the number of the specified window and all windows previously above it.window_name
- The window's screen name.
- 0 The number of the window that was made active—either the value of
window_number
, or the maximum ifwindow_number
is out of range.
- -1 Failure: The window was not found or the window was not open.
sm_wselect
lets you change the active window in a multi-window display. This function is typically used in routines that update information in windows that might be inactive.Only one window—the one at the top of the window stack—can be active at a time, and thereby accessible to library functions and user input. These functions activate a window by bringing it to the top of the window stack and restores the cursor to its last position in it. If the window is hidden by an overlying window, Panther brings it to the forefront of the display.
You can specify a window by its offset into the window stack with
sm_wselect
, or by its screen name withsm_n_wselect
.sm_wselect
involves more work inasmuch as you must keep track of the inactive window's position on the stack. However,sm_wselect
can find windows displayed with sm_d_window or related functions, which do not record the screen name.In character mode,
sm_wselect
selects sibling windows as a group. If any one of a set of sibling windows is activated by this function, then all of the siblings are brought to the top of the window stack. The selected window becomes the active window at the top of this set. Otherwise, the sequence within the set of siblings remains the same.
sm_wselect
andsm_n_wselect
can be used in the following ways:
- Select a hidden screen, update it with sm_putfield, then deselect it with sm_wdeselect. Panther updates the visible portion of the hidden screen with the new data. Because of delayed write, Panther updates the screen only when keyboard input is sought.