comp • gb.ncurses • window

Window (gb.ncurses)

A Window is an object that can be used to display text on the screen. In fact, you are not able to reasonably write anything to the screen without a Window involved. Such a Window occupies its own space of memory - it is tied to the screen, but does not share memory with it.

With this in mind, we can distinguish between the physical screen and an internal, virtual screen which are synchronised at will (buffered output), but by default, the component automatically synchronises them after each operation on the Window's content.

That also means that windows may overlap without overwriting the contents of the other Windows. The mechanism of drawing the right (read: the visible, if we talk about overlapping) piece of memory to the screen, is maintained by the ncurses panel extension library. That is mainly a panel stack that chooses that right piece of memory depending on its Window's position in the panel stack.

This class can be used like an object by creating a hidden instance on demand.
This class is
Creates a new Window:
creatable
.
This class acts like a
Returns a virtual object that can be used to change the attributes connected to the character identified by the Y,X coordinates in the Window.
read-only
array.

Properties

Methods Events
property Read Attributes As comp/gb.ncurses.Window.Attrs
Attributes  
Returns or sets the background color of the Window, i.e. one of the constants in Color. Changes take place on the entire content, not only for subsequent operations as it would be with using .Attributes.Color.
Background  
Returns or sets whether the Window has a border. The border surrounds the Window contents and cannot be overridden by the Window routines (as opposed to the normal ncurses borders which are inner-window).
Border  
Returns or sets whether the output to the Window is buffered or not. By default, it is not. A buffered Window will never produce output automatically but only by a call to refresh ?.
Buffered  
Set a window title if the window has a border. The title (or caption) is printed on the upper border of the window.
Caption  
Returns or sets the Window's cursor x position.
CursorX  
Returns or sets the Window's cursor y position.
CursorY  
Return or set the foreground of the Window.
Foreground  
A synonymous for Height
H  
Returns or sets the height of the Window's contents, which are independent of the border settings.
Height  
The Window.Pair property encodes the fore- and background colours of a character in a single integer, the "pair number".
Pair  
A synonymous for Background
Paper  
A synonymous for Foreground
Pen  
A synonymous for Width
W  
Returns or sets the width of the Window's content, regardless of the border settings.
Width  
Returns or sets wrapping.
Wrap  
Returns or sets the X position of the Window on the screen.
X  
Returns or sets the Y position of the Window on screen.
Y  
Function Ask ( Opts As String [ , Tries As Integer ] ) As String
Ask  
Centers the window on the display.
Center  
The Window.Clear() method clears the screen, i.e. it writes blanks to all characters in the window. Therefore, Window.Clear() colours your entire window with Window.Pair besides erasing all text on it.
Clear  
Clear the window.
Cls  
Drain  
Draw a line beginning at X,Y that goes Len characters on the x-axis. Ch is the character used to draw the line. For a horizontal line, one would use "-". The optional Thickness parameter specifies the expansion in y-axis direction.
DrawHLine  
Draw a line beginning at X,Y that goes Len characters on the y-axis. Ch is the character used to draw the line. For a vertical line, one would use "|". The optional Thickness parameter specifies the expansion in x-axis direction.
DrawVLine  
Function Get ( X As Integer, Y As Integer [ , Len As Integer ] ) As String
Get  
Remove the Window from the panel stack. It is invisible but still exists.
Hide  
Move the Cursor to the location referenced by X,Y.
Locate  
Lower  
Move the Window to the new location referenced by X,Y.
Move  
Sub Print ( Text As String [ , X As Integer, Y As Integer ] )
Print  
This routine aims to print the given Text as close to the centre of the Window as possible. In fact, it tries to print the middle line closest to the vertical centre of the Window and the middle character in each line the closest to the horizontal centre of the Window.
PrintCenter  
Brings the window to the foreground.
Raise  
Read   ReadLine  
Resize the Window as specified by W and H.
Resize  
Set the focus on the particular Window so it raises the Read event.
SetFocus  
SetFullscreen  
Inserts the Window at the top of the panel stack. This function may be used to show a hidden Window.
Show  
The Read event is raised for the currently focused Window whenever data arrives in the input queue (i.e. stdin or the keyboard directly). When, which type, and what amount of data arrives, depends on the input mode currently set.
Read