Creates a subwindow within an existing window.
#include
<curses.h>
WINDOW *subwin
(ParentWindow,
NumLines,
NumCols,Line,Column)
WINDOW * ParentWindow
;
int NumLines, NumCols, Line, Column;
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 (touchwin Subroutine) or touchline subroutine on the parent window before calling the wrefresh (refresh or wrefresh Subroutine) 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. |
my_window = newwin (derwin, newwin, or subwin Subroutine)
(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.
my_window = newwin (derwin, newwin, or subwin Subroutine)
(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.
my_window = newwwin (derwin, newwin, or subwin Subroutine)
(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 (touchwin Subroutine), newwin (derwin, newwin, or subwin Subroutine), and wrefresh (refresh or wrefresh Subroutine) subroutines.
Curses Overview for Programming, List of Curses Subroutines, Windows in the Curses Environment in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.