Terrapin Resources

Terrapin Logo 4 has been discontinued! Our new Terrapin Logo version is much more powerful and modern; we strongly recommend that you update to our latest release of the Logo programming language.

Window management

Management of windows.

Logo provides commands to set the active window and to move and resize windows.

ACTIVEWINDOW

Also: ACTIVEW

Reports the name of the active graphics window.

Syntax

Description

ACTIVEWINDOW reports the name of the currently active window. Change the active window using SETACTIVEWINDOW. The name of currently active window is also available in the system variable :CURRENT.WINDOW.

Example

ACTIVEWINDOW Result: LISTENER

CLOSEWINDOW

Closes a window.

Syntax

Description

CLOSEWINDOW hides the window whose Logo name is the first input. The window is not erased, and may be reopened using the SETACTIVEWINDOW.

Example

CLOSEWINDOW “LISTENER

SETACTIVEWINDOW

Also: SETACTIVEW

Sets the name of the active window.

Syntax

Description

SETACTIVEWINDOW changes the currently active window. The name of the active window is reported by the ACTIVEWINDOW command. You can also set the system variable :CURRENT.WINDOW to change the active window. If the active window is hidden, it is made visible.

Example

SETACTIVEWINDOW “GRAPHICS

SETWINSIZE

Sets the size of a window.

Syntax

Description

SETWINSIZE sets the size of a window. Its input is the name of the window to resize, and a list of two numbers: the width of the window in screen pixels and the window height. WINSIZE reports the current window size. Note that this command changes the size of the window’s drawing area; to change the size of the outer bounds of a window including its frame and title bar, use SETWSIZE.

Change a window’s position using SETXY.

SETWPOS

Sets the position of a window.

Syntax

Description

SETWPOS takes as input the name of the window to move, and a list of two positive integers specifying the position of the upper left corner of the window (in screen coordinates). The current position is reported by WPOS. Change a window’s size using SETWINSIZE or SETWSIZE.

Example

SETWPOS “LISTENER [100 100]

SETWSIZE

Sets the size of a floating window.

Syntax

Description

SETWSIZE sets the size of a window. Its input is the name of the window to resize, and a list of two numbers: the width of the window in screen pixels and the window height, including its frame and title bar. WSIZE reports the current window size. Change a window’s position using SETWPOS. Note that the size or position of a window can only be changed if the window is not docked.

Example

SETWSIZE “LISTENER [600 100]

WINSIZE

Reports the size of a window.

Syntax

Description

WINSIZE reports the size of the drawing area of a window as a list with two elements. The first element is the width in pixels and the second is the height in pixels. The input specifies the target window by its name.

To get the size of the bounding window rectangle, see WSIZE.

See also SETWINSIZE, SETWPOS, and WPOS.

WPOS

Outputs the position of a window.

Syntax

Description

WPOS takes as input the name of the window. It reports the position of the upper left corner of the window as a two-element list. Use SETWPOS to change the position of a window. Change a window’s size using SETWINSIZE or SETWSIZE. Note that the size or position of a window can only be changed if the window is not docked.

Example

WPOS “LISTENER Result: [20 450]

WSIZE

Reports the size of a window.

Syntax

Description

WSIZE reports the size of the outside frame of a window as a list of two elements. The first element is the width in pixels and the second is the height in pixels. The input specifies the target window by its name.

To obtain the size of a window’s drawing area, use WINSIZE.

See also SETWINSIZE, SETWPOS, and WPOS.

Example

WSIZE “GRAPHICS Result: [850 350]