Name

Curses::Window — Character-based window class

Synopsis

Curses::Window is a class for character-based windows implemented by the curses library.

Required Library

require "curses"

Class Method

Curses::Window::new(h,w,y,x)

Creates a new curses window of size (h, w ) at position (y, x ).

Instance Methods

w << str
w.addstr(str)

Outputs str to the screen.

w.addch(ch)

Outputs one character to the screen.

w.begx

Returns the window’s beginning x position.

w.begy

Returns the window’s beginning y position.

w.box(v, h)

Draws a box around the window. v is a character that draws a vertical side. h is a character that draws a horizontal side.

w.clear

Clears the window.

w.close

Closes the window.

w.curx

Returns x position of the window’s cursor.

w.cury

Returns y position of the window’s cursor.

w.delch

Deletes a character at the window’s cursor position.

w.deleteln

Deletes a line at the window’s cursor position.

w.getch

Reads one character from the keyboard.

w.getstr

Reads a line of string from the keyboard.

w.inch

Reads a character at the window’s cursor position.

w.insch(ch)

Outputs one character before the window’s cursor.

w.maxx

Returns the window’s x size.

w.maxy

Returns the window’s y size.

w.move(y, x)

Moves the window to the position (y, x).

w.refresh

Refreshes the window.

w.setpos(y, x)

Moves the window’s cursor to the position (y, x).

w.standend

Turns on standout (highlighting) mode in the window.

w.standout

Turns off standout mode in the window.

w.subwin(h, w, y, x)

Creates a new curses subwindow of size (h, w ) in the window ...

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.