User Tools

Site Tools


weblogo:commands:object_properties

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 panel (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-Only Properties

Note: These properties used to be read-write.

Name Default value Description
WINDOW window name The Graphics panel that the widget is attached to.

Read-Write Properties

Note: The DRAGGABLE, EXTENT, RUN2 ,and TRANSPARENT properties have been removed. The SHADOW property is new, and STEPSIZE has changed. The Z.ORDER property also works for controls.

Name Default value Description
ALIGN This property is only present and available if the widget is part of a Grid control; if not, any attempt to access the property is ignored. When the widget is part of a Grid control, its value is a two element list of alignment values. For horizontal alignment, legal values are LEFT, CENTER and RIGHT. For vertical alignments, legal values are TOP, MIDDLE and BOTTOM. Setting the property aligns the widget inside the table cell; not that for alignments to actually work, the widget must be smaller than the table cell itself. You can also use a single word like LEFT to set just one part of the alignment.
ANCHOR [CENTER MIDDLE] This property takes the same value as the ALIGN property above. Its purpose is to anchor the widget relative to an edge of the Graphics panel. This is especially convenient for controls, who like to stay at the same position regardless of the size of the Graphics panel. If you anchor a control at [LEFT TOP], for example, it will stay at the same position and not move if the panel is resized. An anchor of [RIGHT BOTTOM] would cause the control to move with a constant distance to the right and bottom edges, so if it would be in the panel's lower right corner, it would stay there.
AUTOWIDTH FALSE When the widget is part of a Grid control, setting this property to TRUE causes the widget to auto-resize to the width of the cell that contains the widget; if the cell's size grows, the widget's width grows as well. If the widget is not part of a grid, setting AUTOWIDTH to TRUE does not have any effect until the widget becomes part of a grid.
BORDER The object's border color. Many widgets do not have a visible border by default. For these objects, their border color is returned as a fully transparent black [0 0 0 0]. Setting this property causes a border to appear, or changes a border's color.
COLUMN This property is only present and available if the widget is part of a Grid control; if not, any attempt to access the property is ignored. When the widget is part of a Grid control, it contains the column number of the widget. Setting the property causes the widget to move to the given cell, where is removes the widget found there. The vacated cell is filled with a new STATICTEXT control.
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. The value of 0.9999 is about 200 pixels per second.
FONT [HELVETICA 12 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.
HEADING 0 The widget's heading in degrees.
NAME Widget name The alias name of the widget. Setting this property changes the object's alias name, and also sets the TOOLTIP property.
OPACITY 1 Contains the widget's opacity value. This is a value between 0 (totally transparent, so it is invisible) and 1 (totally opaque). Setting a value lower than 1 make the drawing, other widgets beneath the widget, or the background shine through.
ORIGIN [0 0] The origin of the widget's coordinate system.
ORIGINALNAME The original name of the widget. For turtles, this is the turtle number; for other widgets, this is the name used in the DECLARE command, or the name that Logo assigned to the object during its creation.
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.
ROW This property is only present and available if the widget is part of a Grid control; if not, any attempt to access the property is ignored. When the widget is part of a Grid control, it contains the row number of the widget. Setting the property causes the widget to move to the given cell, where is removes the widget found there. The vacated cell is filled with a new STATICTEXT control.
RUN Contains a list of instructions that Logo runs if the widget is clicked. Note that not all widgets produce click events. During the execution of the runlist, the global variable contains the name of the clicked widget, which can be used to access the widget's properties.
SHADOW 0 The SHADOW property sets the widget's drop shadow. This is a value between 0 and 999, and describes the offset in pixels of the drop shadow. The drop shadow simulates a light source towards the upper left corner of the display. A value of 3, for example, creates a neat little shadow underneath the widget.
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 initially set to TRUE.
SIZE This value outputs the size of the widget's bounding box in pixels. Setting the size causes the control's size to be fixed; this may cause display problems if the size values are too small. Setting either the width or the height to a negative value lets the browser take over the sizing for the width or height. The GRID control ignores the setting of this property, because its size always depends on its contents.
STARTANGLE 0 The starting angle of the widget if it is loaded from the Toolbox. Some images are, for example, faced to the left; the natural starting angle of such an image is, therefore, 270 degrees.
STEPSIZE 1 The multiplicand that FORWARD and BACK movements are multiplied with.
TOOLTIP Widget name The text that Logo displays when the mouse cursor hovers over the widget.
VISIBLE FALSE Setting this property to FALSE hides the object.
Z.ORDER The widget's Z order determines which widget is in front of other widgets. Widgets with a higher Z order appear to be in front of turtles with a lower Z order. Each widget receives its own value when created.

Note: This property works differently from Terrapin Logo. In Terrapin Logo, a lower Z order placed the widget in front of another widget; a Z order value of 0 placed it in front. Terrapin Logo also re-computed the Z order of all widgets automatically if the Z order of a widget was changed. Logo does not do this; you can assign the same Z order value to more than one widget; the real Z order would the depend on the order of the widget's creation.

Callable Properties

All widgets have these commands implemented as callable properties. The global commands simply iterate over the TELL list and do a CPROP of the actual command for each object of the TELL list.

If an object on the TELL list does not know a command (the BITMAP, for example, does not know how to PENDOWN), the object ignores the command. If you, however, ASK an object to do a command thsi it does not know, Logo throws a runtime error.

FORWARD, BACK, LEFT, RIGHT, SETX, SETY, SETXY, SETHEADING, HEADING, HOME, GETXY, GETX, GETY, TOWARDS, DISTANCE, SHOWTURTLE, HIDETURTLE, SHOWN?, FONT, SETFONT, ORIGIN, SETORIGIN, PANGLE, PDIST, PHEADING, PSETHEADING, PPOS, SETP, TURTLESIZE, SETTURTLESIZE, TURTLENAME, LOCKSHAPE, UNLOCKSHAPE, OPACITY, SETOPACITY, SHADOW, SETSHADOW, SPEED, SETSPEED, SLOWTURTLE, STEPSIZE, and SETSTEPSIZE.

Bitmaps (BITMAP)

A BITMAP object is a widget that is almost a turtle; it cannot draw, however. Bitmaps know the following additional commands:

Name Inputs Description
LOAD filename Loads an image file into the bitmap.
SAVE filename Saves the bitmap into an image file.
STAMP Stamps the bitmap onto the Graphics panel. For a detailed description, see the global STAMP command.

Turtles (TURTLE)

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

Read-Write Properties

Name Default value Description
ALPHA 1 The alpha value that the turtle uses to draw with colors that do not have a specific alpha value, like color names, color indexes, or color lists with only three elements. A value of 1 make the color opaque, and a value of 0 makes it completely transparent (invisible).
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 what was loaded. The widget with that name does not need to exist.

Callable Properties

Controls

Controls are widgets that provide the standard operating system widgets like buttons, edit fields, 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.

By default, a control has a transparent background, except for buttons. You can change a control's background color and opacity by setting its BACKGROUND property.

Read-Write Properties

All WIDGET properties, plus the following:

Name Default value Description
BACKGROUND [255 255 255 1] The background color of the control. By default, it is set to White. You cannot set the background color of pushbuttons.
COLOR The text color of the control. The color depends on the type of control, and not every control honors the setting of this property.
ENABLED TRUE Setting this property to FALSE disables the control.
SELECTED FALSE Reads always as FALSE. Set it to TRUE to switch the input focus to the control.
TEXT The text that the control displays.
TEXTALIGN LEFT Setting this property causes any content to be aligned horizontally. Legal values are LEFT, CENTER and RIGHT. Note that some controls like the GRID control ignore the alignment setting.

Push buttons (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 (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 (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 (STATICTEXT)

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

Name Default value Description
AUTOSCROLL FALSE If set to TRUE, a vertical scroll bar appears if the text is too long to display in the available space.

Edit Boxes (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.

Read-Write Properties

Note: The FILTER, LIMIT, and MODIFIED properties have been removed.

Name Default value Description
PLACEHOLDER Edit Me A ghost text that vanishes once the user starts typing. It should indicate what the user should type into the text box.

List Boxes (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.

List box entries are not sorted.

Read-Only Properties

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

Read-Write Properties

Note: The TOPINDEX property is gone; setting the TEXT property no longer replaces the currently selected item, but selects the item whose text matches the given text.

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.
TEXT Reports the text of the currently selected item, or the empty word if no item is selected. Setting the property causes the entry with the given text to be elected. If there is no match for the text, the selection is removed.

Callable Properties

Note: APPEND and INSERT now treat a list as multiple entries.

Name Inputs Description
APPEND text Appends one or more items to the list box. If the input to APPEND is a list, each list element is treated as a separate list box entry. Outputs the index of the last inserted item.
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 one or more items in front of the currently selected item. If no item is selected, the procedure appends the item(s) to the list box contents. If the input to INSERT is a list, each list element is treated as a separate list box entry. Outputs the index of the last inserted item.
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 (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.

Sliders (SLIDER)

A slider has a thumb that you can drag to alter a value. Sliders have a minimum and a maximum value. 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 slider's handle, the contents of the RUN property may be executed very often, because the slider's value changes rapidly.

Note: This control replaces the Terrapin Logo SCROLLBAR control. The SMALLINC and LARGEINC properties have been merged into the INCREMENT property. The VERTICAL property used to make the scrollbar vertical. It has been removed, because you can rotate a control to any angle with the turtle commands RIGHT, LEFT or SETHEADING.

Read-Write Properties

Name Default value Description
INCREMENT 1 The increment value used when you drag the slider.
MAXIMUM 100 The maximum value of the slider. If this value is less than the minimum, the slider does not move anymore.
MINIMUM 0 The minimum value of the slider.
VALUE 0 The current value of the slider.

Grids (GRID)

A grid is a grid of cells that can contain text or widgets. Please refer to the Grids page for more information.

Read-Write Properties

Name Inputs Description
COLOR [204 204 204 1] Controls the color of the grid's cell borders, which are dotted lines. Set the color to [0 0 0 0] or any other color with an alpha value of 0 to make the cell borders invisible.
COLUMNS 3 Returns or sets the number of grid columns. Note that if you set the value, the grid is recreated, causing the contents to get lost, and any widgets to be released.
CELLSIZE [-1 -1] This property sets the minimum size of each grid cell in pixels. The first list item is the width, and the second item is the height of each cell. If you use values that are ⇐ 0, the table aligns it cell width or height to match the widest item in a column, or the tallest item in a row. This is the default.
ROWS 3 Returns or sets the number of grid rows. Note that if you set the value, the grid is recreated, causing the contents to get lost, and any widgets to be released.

Panels

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

Name Default Value Description
LAYOUT This 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.
STATE This property controls the state of a panel. It can be one of four values: NORMAL, MINIMIZED, MAXIMIZED, or HIDDEN.

GRAPHICS

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

Read-Only Properties

Name Default value Description
DRAWSIZE The size of the drawing area in pixels. The SIZE Property is an alias for this property.

Read-Write Properties

Name Default value Description
BGCOLOR [255 255 255] The background color.
BGPATTERN 0 The background pattern.
OFFSET [0 0] 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.
WRAPMODE WRAP The turtle wrap mode; one of WRAP, FENCE, WINDOW, or BOUNCE.
weblogo/commands/object_properties.txt · Last modified: 2019/01/22 06:09 (external edit)