[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

subpad Subroutine


Creates a subwindow within a pad.


Curses Library (libcurses.a)


#include <curses.h>
WINDOW *subpad(Orig, NLines, NCols, Begin_Y, Begin_X)
int NCols, NLines, Begin_Y, Begin_X;


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.


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.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

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.

[ Previous | Next | Contents | Glossary | Home | Search ]