Terrapin Resources

Panels

All panels (LISTENER, GRAPHICS, TOOLBOX, FILES, HELP, EDITOR, DEBUGGER, ICONBAR) have the same core set of properties that control their layout:

LAYOUT

Controls the position and size of a panel.

Description

The LAYOUT property is a four-element list of the left, top, width and height values. All values represent percentage values between 0 and 100, which refer to width and height of Logo’s container window. A width of 50, for example, would cause the panel’s width to be half of the window width.

Note that the LAYOUT property of the ICONBAR is read-only, and reports a list of four zeros, because its position is fixed.

Example

GPROP “LISTENER “LAYOUT Result: [0 60 100 40]

STATE

Controls the display mode of a panel.

Description

This property controls the display mode of a panel. It can be one of four values: NORMAL, MINIMIZED, MAXIMIZED, or HIDDEN.

Note that the ICONBAR treats every other value than HIDDEN as NORMAL, because its position and size cannot be changed.

Example

PPROP “EDITOR “STATE “HIDDEN

LISTENER

Apart from the layout properties, the Listener panel offers properties to track keyboard input and menu commands.

KEY

Reports the last key that the user has typed.

Description

KEY reports the last key that the user has typed. The property is read-only. You can monitor keyboard input with the WHEN command.

Example

WHEN “LISTENER [KEY = “HOME] [PR [GOING HOME]]

GRAPHICS

The Graphics panel offers the following properties in addition to the layout properties:

BGCOLOR

Controls the background color of the Graphics panel.

Description

BGCOLOR controls the background color of the Graphics panel. Initially, this color is transparent so background images can shine through. Try to set the background color’s opacity value together with a background image!

SETBG sets this property.

Example

PPROP “GRAPHICS “BGCOLOR [255 0 0 0.5]

BGPATTERN

Sets the background pattern.

Description

BGPATTERN sets the background pattern using the current background color. Please see the SETBGPATTERN command for alist of possible input values.

Example

ASK “GRAPHICS “BGPATTERN Result: 0

BUTTON

Reports the state of the mouse’s buttons.

Description

BUTTON reports the state of the mouse buttons. The property is read-only. You can monitor the state of the buttons with the WHEN command.

The value of the BUTTON property is 1 for the left button down, 2 for the right button down, and 4 for the middle button down. All of these values can be combined if more than one button is pressed. If the mouse supports more than three buttons, more values like 8, 16, or 32 are possible.

Example

WHEN “GRAPHICS [BUTTON = 1] [PR [LEFT MOUSE BUTTON CLICKED]]

MOUSE

Reports the position of the mouse.

Description

Reports the position of the mouse over the Graphics panel as a two-element list of turtle coordinates. The property is read-only. You can monitor the mouse position with the WHEN command.

Example

WHEN [MOUSE] [PR SE [MOUSE MOVED TO] MOUSE]

OFFSET

Controls the location of the Graphic Panel’s center point.

Description

This property controls the offset of the entire Graphics panel from the original center point. Setting the offset’s first element to, for example, 100, moves all content of the Graphics panel 100 pixels to the right.

Example

GPROP “GRAPHICS “OFFSET Result: [0 0]

SIZE (DRAWSIZE)

Reports the size of the Graphics panel.

Description

SIZE reports the size of the Graphics panel in pixels. The property is read-only. You can monitor any changes of the panel size with the WHEN command.

Example

GPROP “GRAPHICS “SIZE Result: [1360 442]

TOUCH

Reports touch data on touch screen equipped devices.

Description

TOUCH reports a list of lists when one or more fingers touch the surface of the Graphics panel. Each list element stands for a finger. Each “finger list” has three elements. The first element is a two-element list of the X and Y coordinates. The next element is again a two-element list of the touch area’s width and height; a finger is never so small that it touches only a single pixel like a mouse does. Finally, the third element indicates the amount of pressure that the finger applied; this is a value between 0 and 1. For touch screens without pressure sensitivity (most are not pressure sensitive), the value is 1.

The property is read-only. You can monitor the touch data with the WHEN command.

Example

GPROP “GRAPHICS “SIZE Result: [1360 442]

WRAPMODE

Controls how the turtle reacts when it hits the edge of the Graphics panel.

Description

WRAPMODE controls the turtle wrap mode; one of WRAP, FENCE, WINDOW, or BOUNCE.

See the WRAP, FENCE, WINDOW and BOUNCE commands for more details.

Example

GPROP “GRAPHICS “WRAPMODE Result: WRAP