Creates a subwindow within an existing window.
The subwin subroutine creates a subwindow within an existing window. You must supply coordinates for the subwindow relative to the terminal's display. Recall that the subwindow shares its parent's window buffer. Changes made to the shared window buffer in the area covered by a subwindow, through either the parent window or any of its subwindows, affects all windows sharing the window buffer.
When changing the image of a subwindow, it is necessary to call the touchwin or touchline subroutine on the parent window before calling the wrefresh subroutine on the parent window.
Changes to one window will affect the character image of both windows.
When the subwin subroutine is successful, it returns a pointer to the subwindow structure. Otherwise, it returns the following:
ERR | Indicates one or more of the parameters is invalid or there is insufficient storage available for the new structure. |
WINDOW *my_window, *my_sub_window; my_window = newwin(5, 10, 20, 30); my_sub_window = subwin(my_window, 2, 5, 20, 30);my_sub_window is now a subwindow 2 lines deep, 5 columns wide, starting at the same coordinates of its parent window my_window . That is, the subwindow's upper-left corner is at coordinates y = 20 , x = 30 and lower-right corner is at coordinates y = 21 , x = 34 .
WINDOW *my_window, *my_sub_window; my_window = newwin(5, 10, 20, 30); my_sub_window = subwin(my_window, 2, 0, 20, 30);
my_sub_window is now a subwindow 2 lines deep, extending all the way to the right side of its parent window my_window , and starting at the same coordinates. That is, the subwindow's upper-left corner is at coordinates y = 20 , x = 30 and lower-right corner is at coordinates y = 21 , x = 39 .
WINDOW *my_window, *my_sub_window my_window = newwwin(5, 10, 20, 30); my_sub_window = subwin(my_window, 0, 0, 22, 35);
my_sub_window is now a subwindow that fills the bottom right corner of its parent window, my_window , starting at the coordinates y = 22 , x = 35 . That is, the subwindow's upper-left corner is at coordinates y = 22 , x = 35 and lower-right corner is at coordinates y = 24 , x = 39 .
This subroutine is part of Base Operating System (BOS) Runtime.
The touchwin, newwin, and wrefresh subroutines.
Curses Overview for Programming, List of Curses Subroutines, Windows in the Curses Environment in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.