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.

Object Properties

Logo has quite a few built-in objects, the most well-known being the TURTLE object. This section documents the properties of these objects.

Most properties are both readable and writeable. A few properties are read-only. An attempt to change such a property is silently ignored.

Some properties are callable properties. To call a property, use the CPROP command as in this example:

The “PREFS and “LOGO.ENV objects are not part of this section, because they are global names rather than creatable objects. Please click on either “PREFS or “LOGO.ENV to see their property lists.

Widgets

All objects that can be moved around on the Graphics screen (the widgets) have a common set of properties.

A widget can move around, it can be hidden or shown, enabled or disabled, and the size can be changed. Widgets include turtles, buttons, bitmaps and the like.

If the command IS.A object “WIDGET outputs TRUE, the object has the properties listed below. If you for example, ask a BUTTON widget if it is a button or a widget, it would always respond with TRUE:

DECLARE “BUTTON “OK IS.A “OK “BUTTON Result: TRUE IS.A “OK “WIDGET Result: TRUE

This makes it easier to use the correct properties with a widget. A turtle, for example, does not have a TEXT property like a button has, but both share the POSITION property. This way, a Logo program can easily check if a property is OK to use with the help of the IS.A command.

Read-Write Properties

Note: The Terrapin Logo 3 properties ORIGSIZE and VELOCITY have been removed. Instead of using VELOCITY, use the CRAWL property.

Name Default value Description
CRAWL 1 The speed at which the object moves when told to move. If set to a value less than 1, the object moves slower. If set to a value > 1, the turtle starts moving independently at a speed of about the value set as pixels per second. A value of 200, for example, moves the widget at a speed of about 200 pixels per second.
DRAGGABLE This property controls whether a widgets can be dragged around or not. Its initial setting contains the value of the "PREF object's DRAGGABLE.OBJECTS property. Setting this property to FALSE protects the widget from being dragged around.
EXTENT [0 0] The number of units to move for the widget from its HOME position to the window borders. An EXTENT value of [2 2], for example, causes the widget to move two units in each direction to reach the border.
HEADING 0 The widget's heading in degrees.
NAME Widget name The name of the widget. Setting this property renames the object, and also sets the TOOLTIP property.
ORIGIN [0 0] The origin of the widget's coordinate system.
POSITION The widget's position on the drawing surface in local object coordinates, rounded to integers. The position is the center point of the object.
RUN Contains a list of instructions that Logo runs if the widget is clicked or changed. Note that not all widgets send click or change events.
RUN2 Contains a list of instructions that Logo runs if the widget is double-clicked. Note that not all widgets send click or change events. Especially controls do not use this property, because they handle double-clicks themselves.
SHAPELOCK FALSE If this property is set to TRUE, the widget does not rotate, but keeps its current rotated view when its heading changes. Controls have this property always set to TRUE.
SHOWHEADING FALSE If set to TRUE, the widget displays an arrow to indicate its heading.
SIZE This value outputs the widget's size in pixels. Setting the property resizes the widget.
STARTANGLE 0 The starting angle of the widget if it is dropped from the Toolbox. Some images are, for example, faced to the left; its natural starting angle is, therefore, 270 degrees.
STEPSIZE 1 The multiplier for X and Y coordinates. A number affects both the X and Y movements. If this property holds a list, the first element of this two-element list is for horizontal coordinates, and the second for vertical coordinates.
TOOLTIP Widget name The text that Logo displays when the mouse cursor hovers over the widget.
TRANSPARENT [] This property contains the color that Logo should treat as the transparent color. This value is important for BMP and JPG images that do not support transparent pixels. The PNG format supports transparent pixels; for PNG images, the value of this property may have undesired side effects. Setting this property to an empty list clears all transparency information.

The value may be a color value, which is either a number between 0 and 146 for the 147 Web colors, a Web color name (see COLORS), or a list with three values between 0 and 255 for the Red, Green and Blue components of the color.

If you save the turtle shape as a PNG file, the transparency information is saved with the image. BMP and JPG formats do not save transparency information.

VISIBLE FALSE Setting this property to FALSE hides the object.
WINDOW window name The Graphics window that the widget is attached to.
Z.ORDER 0 The widget's Z order determines which widget is in front of other widgets. Widgets with lower Z order appear to be in front of turtles with a higher Z order. Note that controls ignore this property; they are always in front of other widgets.

Turtles

This section describes the properties that the TURTLE object offers in addition to the WIDGET properties.

Read-Write Properties

Name Default value Description
FONT [Consolas 9 0] The font that the object uses to draw text. This is a three-element list of the font name, its size in pixels, and a combination of attribute flags. See the SETFONT command for details.
PATTERN 0 The pattern that a turtle uses to fill shapes. This may be a value, an 8-element list, or the name of a bitmap whose black-and-white representation is used to fill an area. See the SETPATTERN command for details.
PENCOLOR [0 0 0] The color of the turtle pen.
PENSTATE PENDOWN The state of the turtle pen, one of the words PENDOWN, PENUP, PENERASE or PENREVERSE.
PENWIDTH 1 The size of the turtle pen in pixels.
SHAPE (empty word) The turtle’s shape is the name of another object (usually a bitmap or a bitmap file) that is used to represent the turtle. Setting the SHAPE property to the empty word sets the standard turtle shape. If the LOADSHAPE command loaded the shape, the property value is the name of the file that was loaded. The widget with that name does not need to exist.

Controls

Controls are widgets that provide the standard operating system widgets like buttons, edit field, and the like. Logo supports a number of standard controls. All controls contain the same set of properties as all widgets, plus a few extra properties.

Controls are operating system objects; Logo does not have immediate control over all of its features. Therefore, the following properties do not have any effect, even if they are present:

SHOWHEADING
STARTANGLE
TRANSPARENT
Z.ORDER

Read-Write Properties

All WIDGET properties, plus the following:

Name Default value Description
ENABLED TRUE Setting this property to FALSE disables the control.
SELECTED FALSE Contains TRUE if the control has the input focus. Set it to TRUE to switch the input focus to the control.
FONT [Consolas 9 0] The font that the control uses to draw text. This is a three-element list of the font name, its size in pixels, and a combination of attribute flags. See the SETFONT command for details.
TEXT   The text that the control displays. Scroll bars do not have any text; they ignore this property. Note that on Windows, the ampersand character (&) has a special meaning; it is used to mark the following character as having a hotkey, and the following character will be underlined. To output an ampersand character, use two ampersands (&&).

Push buttons

Also: BUTTON

A pushbutton is a clickable widget that acts like a button.

It contains all WIDGET and CONTROL properties. The TEXT property sets the button label, and the contents of the RUN property are executed if the button is clicked.

Check boxes

Also: CHECKBOX

A checkbox is a box with a check mark that can be turned on and off.

It contains all WIDGET and CONTROL properties. The TEXT property sets the checkbox label, and the contents of the RUN property are executed if the checkbox’s check mark changes.

Read-Write Properties

Name Default value Description
STATE FALSE The state of the checkbox.

Radio Buttons

Also: RADIOBUTTON

A radio button is a box with a round clickable area that can be turned on. Usually, radio buttons are grouped together, and only one of the buttons should be turned on. A well-written Logo program should, therefore, turn off all other radio buttons in a group if a button in this group has been turned on. Set a radio button’s STATE property to FALSE to turn it off. A radio button contains the same set of properties as a CHECKBOX widget.

Text fields

Also: STATICTEXT

A text field (or label) grey box that displays non-editable text. It contains all WIDGET and CONTROL properties. It can be clicked, and its text can be set.

Edit Boxes

Also: EDITBOX

An edit box is a box with a single line of editable text. It contains all WIDGET and CONTROL properties, plus a few extra properties that are listed below. Logo executes the contents of the RUN property every time the text changes; it cannot be clicked to execute the RUN property.

The Terrapin Logo property FILTER is not supported anymore.

Read-Write Properties

Name Default value Description
FILTER   A list of characters that the user is permitted to type.
LIMIT 2147483647 The size of the text that the user is allowed to enter.
MODIFIED FALSE This property is TRUE if the text has been modified.

List Boxes

Also: LISTBOX

A list box is a box that displays a number of choices. The user can select a choice with a mouse click. You can select an entry by setting its INDEX property to the zero-based index. It contains all WIDGET and CONTROL properties, plus a few extra properties that are listed below. Logo executes the contents of the RUN property every time the selection changes; it cannot be clicked to execute the RUN property.

Read-Only Properties

Name Default value Description
ITEMCOUNT 0 The number of items in the list box.

Read-Write Properties

Name Default value Description
INDEX -1 The zero-based index of the currently selected item. The value is -1 if no item has been selected.
TOPINDEX -1 The index of the first visible item of the listbox. Set this property to scroll an entry into view.

Callable Properties

Name Inputs Description
ADDSORTED text Appends an item to the list box, and re-sorts the contents of the list box alphabetically.
APPEND text Appends an item to the list box.
CLEAR   Erases the contents of the list box.
FIND text Searches the text in the list box and returns the index of the item if the text is found (case insensitive). If the text cannot be found, returns -1.
INSERT   Inserts an item in front of the currently selected item. If no item is selected, the procedure appends the item to the list box contents.
ITEM index Output the list box item at position index (0-based). If the index is out of range, output the empty word.
REMOVE index Removes the item at the given index position. If the index is out of range, the procedure does nothing.
REPLACE text Replaces the currently selected item with another text. If the list box is sorted, the items may be re-sorted. The item remains selected. If no item is selected, the procedure does nothing.

Popups

Also: POPUP

A popup is a widget that displays a single choice. When clicked, a list drops down (or pops up) to display all possible choices. Popups are functionally identical to list boxes. Therefore, a popup contains the same properties as a list box.

A POPUP widget is also a LISTBOX widget.

Scroll Bars

Also: SCROLLBAR

A scroll bar is a slider with a thumb that you can drag to alter a value. Scroll bars have a minimum and a maximum value. If you click on one of the ends, the Small Increment value is applied, and if you click into the area between the ends and the thumb, the Large Increment value is applied. It contains all WIDGET and CONTROL properties, plus a few extra properties that are listed below. Logo executes the contents of the RUN property every time the selection changes; a simple click does not execute the RUN property. Please note that when you drag the scroll bar’s slider, the contents of the RUN property may be executed very often, because the scroll bar’s value changes rapidly.

Read-Write Properties

Name Default value Description
LARGEINC 10 The increment value used if you click into the area between an end and the thumb.
MAXIMUM 100 The maximum value of the scroll bar. If this value is less than the minimum, the scroll bar counts downwards.
MINIMUM 0 The minimum value of the scroll bar.
SMALLINC 1 The increment value used if you click onto one of the ends.
VALUE 0 The current value of the scroll bar.
VERTICAL FALSE Sets the orientation of the scroll bar to vertical if set to TRUE.

Windows

All windows share the same set of core properties. Use the command EVERY “WINDOW to get the list of windows.

Read-Write Properties

Name Default value Description
DRAWSIZE   The size of the drawing area in pixels.
MAXIMIZED   Setting this property to TRUE maximizes the window.
POSITION   The position of the window in screen coordinates.
SIZE   The outer size of the window, including the border, the title bar, and so on.
TITLE   The text displayed in the window’s title bar.
VISIBLE TRUE or FALSE Setting the value to FALSE hides the window.

GRAPHICS

The Graphics window offers the following additional properties:

Read-Write Properties

Name Default value Description
BGCOLOR [255 255 255] The background color.
BGPATTERN 0 The background pattern.
GRIDSPACING [100 100] The spacing of the coordinate grid in pixels in X and Y directions.
GRIDVISIBLE FALSE Controls the visibility of the coordinate grid.
WRAPMODE WRAP The turtle wrap mode; one of WRAP, FENCE, or WINDOW.

LISTENER and TRACEWINDOW

These two windows have the following additional properties.

Read-Write Properties

Name Default value Description
CHANNEL 0 or 1 The number of the output channel that would print into the window. LISTENER has the channel number 0, and TRACEWINDOW the channel number 1. This property is read-only.
FONT [Consolas 10 0] The font for the given window.
LINES 500 The number of lines in the Listener (LISTENER only).

EDITOR

This window has the following additional property.

Read-Write Properties

Name Default value Description
FONT [Consolas 10 0] The font for the editors.
MODIFIED FALSE The property contains TRUE if the contents have been modified, but not saved yet.

ARRAY

Name Default value Description
DIMENSIONS   The array dimensions as a list. Altering this value causes the array to be erased.
BYTEARRAY? TRUE or FALSE The value of this read-only property depends on whether the array is a Logo array or a byte array.