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 synchronized at will (buffered output), but by default, the component automatically synchronizes 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
creatable.
This class acts like a
read-only array.
Properties
Attributes
|
property Read Attributes As comp/gb.ncurses.Window.Attrs
|
Background
|
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.
|
Border
|
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).
|
Buffered
|
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 ?.
|
Caption
|
Set a window title if the window has a border. The title (or caption) is printed on the upper border of the window.
|
CursorX
|
Returns or sets the Window's cursor x position.
|
CursorY
|
Returns or sets the Window's cursor y position.
|
Foreground
|
Return or set the foreground of the Window.
|
H
|
A synonymous for Height
|
Height
|
Returns or sets the height of the Window's contents, which are independent of the border settings.
|
Pair
|
The Window.Pair property encodes the fore- and background colours of a character in a single integer, the "pair number".
|
Paper
|
A synonymous for Background
|
Pen
|
A synonymous for Foreground
|
W
|
A synonymous for Width
|
Width
|
Returns or sets the width of the Window's content, regardless of the border settings.
|
Wrap
|
Returns or sets wrapping.
|
X
|
Returns or sets the X position of the Window on the screen.
|
Y
|
Returns or sets the Y position of the Window on screen.
|
Methods
Ask
|
Function Ask ( Opts As String [ , Tries As Integer ] ) As String
|
Center
|
Centers the window on the display.
|
Clear
|
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.
|
Cls
|
Clear the window.
|
Drain
|
Empty the Input buffer, discard all characters
|
DrawHLine
|
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.
|
DrawVLine
|
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.
|
Get
|
Function Get ( X As Integer, Y As Integer [ , Len As Integer ] ) As String
|
Hide
|
Remove the Window from the panel stack. It is invisible but still exists.
|
Locate
|
Move the Cursor to the location referenced by X,Y.
|
Lower
|
Send widow to background
|
Move
|
Move the Window to the new location referenced by X,Y.
|
Print
|
Sub Print ( Text As String [ , X As Integer, Y As Integer ] )
|
PrintCenter
|
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.
|
Raise
|
Brings the window to the foreground.
|
Read
|
Reads a single character from the stdin with a timeout.
|
ReadLine
|
Read a full line from the current window.
|
Resize
|
Resize the Window as specified by W and H.
|
SetFocus
|
Set the focus on the particular Window so it raises the Read event.
|
SetFullscreen
|
Set the window to the full size of the screen
|
Show
|
Inserts the Window at the top of the panel stack. This function may be used to show a hidden Window.
|
Events
Read
|
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.
|