chickadee » mojo » make-win

make-win #!key width height left right top bottom left-of right-of below above box backgroundprocedure

Convenience constructor function so you don't have to (use coops) in your program to create window objects.

box is a boolean indicating whether to draw a border box around the window. The default is #t.

background is a boolean indicating whether to fill the window's background with the foreground color. It does not work very well. The default is #f.

All other arguments are used for specifying dimension, position and relation of the window. In the simplest case, a width and a height is given as well as absolute top/bottom and left/right positions:

(make-win width: 10 height: 5 left: 2 top: 2)

However, almost all combinations are possible, e.g. one could leave out the width and only specify the positions from the left and right borders of the terminal. This will result in a variable width window that is resized when the terminal is resized, maintaining its distance from the left and right borders:

(make-win height: 5 top: 2 left: 2 right: 2)

The left-of, right-of, above and below arguments can take other windows as values. All positions and distances are then relative to the outer borders of that window. For example:

(define foo (make-win width: 2 height: 1 left: 2 top: 2))
(define bar (make-win right-of: foo width: 2 height: 1 left 1))

This will draw bar on the right of foo with 1 unit distance between them. Since no vertical positioning of bar is given its upper border will align with that of foo.