Creates a subwindow within a pad.
Curses Library (libcurses.a)
The subpad subroutine creates and returns a pointer to a subpad. A subpad is a window within a pad. You specify the size of the subpad by supplying a starting coordinate and the number of rows and columns within the subpad. Unlike the subwin subroutine, the starting coordinates are relative to the pad and not the terminal's display.
Changes to the subpad affect the character image of the parent pad, as well. If you change a subpad, use the touchwin or touchline subroutine on the parent pad before refreshing the parent pad. Use the prefresh subroutine to refresh a pad.
Item | Description |
---|---|
Orig | Points to the parent pad. |
NLines | Specifies the number of lines (rows) in the subpad. |
NCols | Specifies the number of columns in the subpad. |
Begin_Y | Identifies the upper left-hand row coordinate of the subpad relative to the parent pad. |
Begin_X | Identifies the upper left-hand column coordinate of the subpad relative to the parent pad. |
To create a subpad, use:
WINDOW *orig, *mypad;
orig = newpad(100, 200);
mypad = subpad(orig, 30, 5, 25, 180);
The parent pad is 100 lines by 200 columns. The subpad is 30 lines by 5 columns and starts in line 25, column 180 of the parent pad.