Widget
Based on WIDGET: BITMAP, TURTLE, BUTTON, CHECKBOX, RADIOBUTTON, EDITBOX, LISTBOX, POPUP, SLIDER, STATICTEXT, WEBCAM
All objects that can be moved around on the Graphics panel (widgets) have a common set of properties. You cannot create a WIDGET object, only objects that are also widgets.
A widget can move, it can be hidden or shown, enabled or disabled, and its size can be changed. Widgets include turtles, controls, and bitmaps.
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.
This makes it easier to use the correct properties with a widget. A turtle, for example, does not have a TEXT property as a button does, 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.
ANCHOR
Part of: WIDGET
Controls the anchoring of a widget.
Syntax
GPROP "BUTTON "ANCHOR
Description
This property anchors the widget relative to the borders of the Graphics panel. For horizontal alignments, valid values are LEFT
, CENTER
, and RIGHT
. For vertical alignments, valid values are TOP
, MIDDLE
, and BOTTOM
. Widgets often like to stay at the same position regardless of the size of the Graphics panel. If you anchor a widget 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 widget to move with a constant distance to the right and bottom borders, so if it were put in the panel’s lower right corner, it would stay there.
The default value is [CENTER MIDDLE].
Note that turtles cannot be anchored; they ignore the ANCHOR property.
Examples
DRAW ; Drop a BUTTON widget from the Toolbox > Controls BUTTON dropped GPROP “BUTTON “ANCHOR
BORDER
Part of: WIDGET
Sets or reports the widget’s border color.
Syntax
GPROP widget "BORDER
PPROP 0 "BORDER color
Description
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.
Use the color "TRANSPARENT
or [0 0 0 0]
to erase the border.
Examples
PPROP 0 “BORDER “RED
BOUNDS
Part of: WIDGET
Reports the widget’s size, depending on the scale and rotation.
Syntax
GPROP 0 "BOUNDS
Description
The BOUNDS property reports the size that the widget occupies on screen after applying scale and heading as a two-element list containing the width and height of the occupied screen area. Note that this is different from the SIZE property, which reports the size of the widget’s image. When a widget is rotated, the BOUNDS property has greater valuer than the SIZE property, because the rotated image takes up more screen space.
Note: In earlier Logo versions, the SIZE property contained the actual size of the widget.
Examples
GPROP 0 “BOUNDS Result: [32 32]
CRAWL
Part of: WIDGET
Sets or reports the widget’s crawl speed.
Syntax
GPROP widget "CRAWL
PPROP 0 "CRAWL speed
Description
CRAWL controls 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. The SETSPEED and SPEED commands work with this property.
Examples
PPROP 0 “CRAWL 0.5 FD 100
ENABLED
Part of: WIDGET
Enables or disables a widget.
Syntax
GPROP widget "ENABLED
PPROP "BUTTON "ENABLED TRUE/FALSE
Description
Setting the ENABLED property to FALSE causes the widget to be disabled. Its appearance changes to indicate that is no longer available for input, and it cannot be edited or clicked.
Examples
DRAW ; Drop a BUTTON widget from the Toolbox > Controls BUTTON dropped PPROP “BUTTON “ENABLED FALSE
FONT
Part of: WIDGET
Sets or reports the widget’s font.
Syntax
GPROP "BUTTON "FONT
Description
FONT controls the font that the widget 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. For controls, the property controls the font that the widget uses to display text.
Examples
DRAW ; Drop a BUTTON widget from the Toolbox > Controls BUTTON dropped GPROP “BUTTON “FONT Result: [HELVETICA 12 0]
GLOW
Part of: WIDGET
Determines whether the widget’s drop shadow appears as a glow effect.
Syntax
GPROP widget "GLOW
PPROP widget "GLOW TRUE/FALSE
Description
The GLOW property, together with the SHADOW property, sets the widget’s drop shadow to a glow effect. Set it to TRUE to enable the glow effect.
Examples
PPROP 0 “SHADOW 3 PPROP 0 “GLOW TRUE
HEADING
Part of: WIDGET
Controls the widget’s heading.
Syntax
GPROP widget "HEADING
PPROP widget "HEADING angle
Description
HEADING reports or sets the widget’s heading as a number between 0 and 359 as degrees. The HEADING and SETHEADING commands use this property.
To lock the heading, see the SHAPELOCK property.
Examples
PPROP 0 “HEADING 270
NAME
Part of: WIDGET
Sets or reports the object’s alias name.
Syntax
GPROP widget "NAME
PPROP widget "NAME word
Description
NAME sets or reports the alias name of the widget. Setting this property changes the object’s alias name, and also sets the TOOLTIP property. The TURTLENAME and SETTURTLENAME commands use this property.
Examples
GPROP 0 “NAME Result: 0
OPACITY
Part of: WIDGET
Controls the opacity value used for colors.
Syntax
GPROP widget "OPACITY
PPROP widget "OPACITY value
Description
The value of OPACITY is used for colors without any opacity value. The opacity value is a value between 0 (totally transparent, so it is invisible) and 1 (totally opaque). Setting a value lower than 1 makes a drawing, other widgets beneath the widget, or the background shine through.
Examples
PPROP 0 “OPACITY 0.5
ORIGIN
Part of: WIDGET
Controls the origin of the widget’s coordinate system.
Syntax
GPROP widget "ORIGIN
PPROP widget "ORIGIN list
Description
This property lets you change the home position of a widget (coordinates [0 0]). Usually, this is the center of the Graphics panel, but you can set this home position to anywhere on the Graphics panel.
Examples
GPROP 0 “ORIGIN Result: [0 0]
ORIGINALNAME
Part of: WIDGET
Reports the widget’s original name.
Syntax
GPROP widget "ORIGINALNAME
Description
The original name of the widget is the name it was given when it was created. 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. The property is read-only.
Examples
GPROP 0 “ORIGINALNAME Result: 0
POSITION
Part of: WIDGET
Sets or reports the widget’s position.
Syntax
GPROP widget "POSITION
PPROP widget "POSITION list
Description
The position is the coordinate located directly underneath the center of the widget. Setting this property causes the widget to move. The reported values are always integer values.
Examples
GPROP 0 “POSITION Result: [50 50]
RUN
Part of: WIDGET
Stores a runlist that Logo executes when the widget is clicked.
Syntax
GPROP widget "RUN
PPROP widget "RUN runlist
Description
RUN contains a list of instructions that Logo runs if the widget is clicked, or a control’s item was selected. This list is initially empty. Some controls ignore the RUN property.
Examples
PPROP 0 “RUN [FD RANDOM 200 RT RANDOM 360]
SCALE
Part of: WIDGET
Controls the widget’s scaling.
Syntax
GPROP widget "SCALE
PPROP widget "SCALE scale
Description
The SCALE property controls the scaling of a widget, which is the sizing factor. A scaling factor of 2, for example, makes a widget twice as big, and a factor of 0.5 makes its size shrink by half. The property value is either a number, or a two-element list for different scaling values for the width and height.
The TURTLESIZE and SETTURTLESIZE commands use this property.
Examples
PPROP 0 “SCALE 3
SHADOW
Part of: WIDGET
Controls the widget’s drop shadow.
Syntax
GPROP widget "SHADOW
PPROP widget "SHADOW size
Description
The SHADOW property sets the widget’s drop shadow. This is a value between 0 and 99, 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.
Also, you can select a glow effect rather than a shadow by setting the widget’s GLOW property to TRUE.
The SHADOW and SETSHADOW commands use this property.
Examples
PPROP 0 “SHADOW 3
SHAPELOCK
Part of: WIDGET
Locks or unlocks a widget’s rotation.
Syntax
GPROP widget "SHAPELOCK
PPROP widget "SHAPELOCK TRUE/FALSE
Description
If this property is set to TRUE, the widget does not rotate, but keeps its current rotated view when its heading changes.
Examples
PPROP 0 “SHAPELOCK TRUE SETH 45
SIZE
Part of: WIDGET
Reports or sets the size of the widget’s image size.
Syntax
GPROP widget "SIZE
PPROP widget "SIZE list
Description
SIZE reports the size of the widget’s image size in pixels, without any scaling or rotation taken into account. When setting the size of a widget, scaling and rotation are applied after the size has been set. The SIZE property reports a two-element list, which is the widget’s width and height. If you use a value less than zero when setting the SIZE property, Logo picks the default value for the respective list element. If you, for example, set a button’s size to [100 -1], the button will be 100 pixels wide, and its height depends on the operating system.
Examples
GPROP 0 “SIZE Result: [32 32]
STARTANGLE
Part of: WIDGET
Contains the starting angle of a widget if dropped.
Syntax
GPROP widget "STARTANGLE
Description
STARTANGLE contains the starting angle of the widget if it is dropped from the Toolbox. Some images, for example, face towards the left; the natural starting angle of such an image is, therefore, 270 degrees.
Examples
DRAW ; Drop a goat from the Toolbox GOAT dropped GPROP “GOAT “STARTANGLE Result: 270
STEPSIZE
Part of: WIDGET
Controls the number of pixels per step that the widget moves forward or back.
Syntax
GPROP widget "STEPSIZE
PPROP widget "STEPSIZE size
Description
The multiplicator that FORWARD and BACK movements are multiplied with. If you set STEPSIZE to 20, for example, the command FD 1
would move the widget 20 pixels forward.
Examples
PPROP 0 “STEPSIZE 20 FD 10
TOOLTIP
Part of: WIDGET
Controls the contents of the widget’s tool tip.
Syntax
GPROP widget "TOOLTIP
PPROP widget "TOOLTIP text
Description
The TOOLTIP property controls the text that Logo displays when the mouse cursor hovers over the widget. Initially, the tool tip is set to the widget’s name.
Examples
PPROP 0 “TOOLTIP “|I am Joe|
VELOCITY
Part of: WIDGET
Controls the speed at which a widget moves independently.
Syntax
GPROP widget "VELOCITY
PPROP widget "VELOCITY number
Description
The value of the VELOCITY property controls the speed at which a widget moves on the screen independently. The permitted range of values is 0 to 500; 0 means that there is no independent movement, while any other value causes the widget to move at the given speed, which is approximately the number of pixels (dots) per second.
Examples
PPROP 0 “VELOCITY 100
VISIBLE
Part of: WIDGET
Hides or shows the widget.
Syntax
GPROP widget "VISIBLE
PPROP widget "VISIBLE TRUE/FALSE
Description
Setting this property to FALSE hides the widget; set it to TRUE to display the widget.
Examples
PPROP 0 “VISIBLE FALSE
WINDOW
Part of: WIDGET
Reports the name of the Graphics panel that this widget is attached to.
Syntax
GPROP 0 "WINDOW
Description
WINDOW reports the name of the Graphics panel that this widget is attached to. It outputs GRAPHICS
, because there is only a single Graphics panel. The property is retained for backwards compatibility.
The property is read-only.
Examples
GPROP 0 “WINDOW Result: GRAPHICS
WRAPMODE
Part of: WIDGET
Sets a widget’s individual wrap mode.
Syntax
GPROP widget "WRAPMODE
PPROP widget "WRAPMODE mode
Description
The WRAPMODE property sets an individual wrap mode for a widget. The default value is DEFAULT
, which means that the widget uses the Graphics panel’s wrap mode. It can be set to one of BOUNCE
, FENCE
, WRAP
, or WINDOW
.
Examples
PPROP 0 “WRAPMODE “BOUNCE RT 30 FD 1000
Z.ORDER
Part of: WIDGET
Controls the sequence of widgets when displayed.
Syntax
GPROP widget "Z.ORDER
PPROP widget "Z.ORDER number
Description
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.
Examples
GPROP 0 “Z.ORDER Result: 1