Terrapin Resources

The Graphics Panel

The GRAPHICS panel contains properties that are relevant to graphics and mouse, like the sizem, the wrapping mode, or the mouse position.


BGCOLOR

Part of: GRAPHICS

Controls the background color of the Graphics panel.

Syntax

GPROP "GRAPHICS "BGCOLOR
PPROP "GRAPHICS "BGCOLOR color

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.

Examples

GPROP “GRAPHICS “BGCOLOR Result: [255 255 255 0] PPROP “GRAPHICS “BGCOLOR [255 0 0 0.5]


BGPATTERN

Part of: GRAPHICS

Controls the background pattern.

Syntax

GPROP "GRAPHICS "BGPATTERN
PPROP "GRAPHICS "BGPATTERN pattern

Description

BGPATTERN controls the background pattern using the current background color. Please see the SETBGPATTERN command for a list of possible input values.

Examples

GPROP “GRAPHICS “BGPATTERN Result: 0


BUTTON

Part of: GRAPHICS

Reports the state of the mouse’s buttons.

Syntax

GPROP "GRAPHICS "BUTTON
WHEN "GRAPHICS [BUTTON = 1] [PR [LEFT MOUSE BUTTON CLICKED]]

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.

Examples

GPROP “GRAPHICS “BUTTON Result: 0


FROZEN

Part of: GRAPHICS

Reports TRUE if the graphics are frozen.

Syntax

GPROP "GRAPHICS "FROZEN

Description

Reports TRUE if the Graphics panel is frozen. A frozen panel does not update while drawing to prevent unneccessary flicker. The FREEZEPIC and UNFREEZEPIC commands handle this property.

Examples

GPROP “GRAPHICS “FROZEN Result: FALSE


MOUSE

Part of: GRAPHICS

Reports the position of the mouse.

Syntax

GPROP "GRAPHICS "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.

Examples

GPROP “GRAPHICS “MOUSE Result: [102 -35]


OFFSET

Part of: GRAPHICS

Controls the location of the Graphics panel’s center point.

Syntax

GPROP "GRAPHICS "OFFSET

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. If you provide a single input (a number) as input, it sets the offset to that value in both directions.

Note: Due to a bug in Logo, the value for the vertical offset is inverted. A positive value moves the origin down, not up.

Examples

GPROP “GRAPHICS “OFFSET Result: [0 0]


SIZE

Part of: GRAPHICS

Reports the size of the Graphics panel.

Syntax

GPROP "GRAPHICS "SIZE

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.

Examples

GPROP “GRAPHICS “SIZE Result: [1032 899]


TOUCH

Part of: GRAPHICS

Reports touch data on touch screen equipped devices.

Syntax

GPROP "GRAPHICS "TOUCH

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

Examples

GPROP “GRAPHICS “TOUCH Result: []


VISIBLE

Part of: GRAPHICS

Reports the panel’s visibility

Syntax

GPROP "GRAPHICS "VISIBLE

Description

The VISIBLE property reports TRUE if the panel is part of the current view. If the panel is invisible because it is not part of the current view, it reports FALSE. The property is read-only.

Examples

GPROP “GRAPHICS “VISIBLE Result: TRUE


WRAPMODE

Part of: GRAPHICS

Controls how a widget reacts when it hits the edge of the Graphics panel

Syntax

GPROP "GRAPHICS "WRAPMODE
PPROP "GRAPHICS "WRAPMODE mode

Description

WRAPMODE controls wrap mode for all widgets (turtles, bitmaps etc.); one of WRAP, FENCE, WINDOW, or BOUNCE. Wrap modes can be set for individual widgets by setting their own WRAPMODE property.

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

Examples

GPROP “GRAPHICS “WRAPMODE Result: WRAP