Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.ext
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mysql
gb.ncurses
.Char.Attrs
Attr
Border
Color
Cursor
Key
Pair
Screen
Window
_get
_new
Ask
Attributes
Background
Border
Buffered
Caption
Center
Clear
Cls
CursorX
CursorY
DrawHLine
DrawVLine
Foreground
Get
H
Height
Hide
Locate
Move
Pair
Paper
Pen
Print
PrintCenter
Raise
Read
Resize
SetFocus
Show
W
Width
Wrap
X
Y
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

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 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  
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  
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  
ReadLine  
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  
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.