Compass Widget

Writings
Software
Links
About
Compass

This page contains a compass widget parcel for VisualWorks 5i Smalltalk. You can get a non-commercial version of VisualWorks 5i from the above URL. The compass widget is made available under the terms of the GNU LGPL.

Download

Installation

Either copy the .pcl and .pst files to the parcels subdirectory of your VisualWorks installation directory or keep them locally; the search path for parcels usually includes the current working directory.

Load the compass widget into an image using the Tools > Load Parcel Named ... menu option. The CoolImage parcel will also be loaded.

Usage

Palette Loading the compass widget parcel will add the compass widget to the UI painter palette. This widget can be placed in the same way as any other widget.

Rose A background "rose" showing the cardinal points of the compass is used by default. To change the rose, define a method which returns an image on your UI. Add the method name to the Rose property using the properties tool for the widget; this method is a resource and can appear on either the class or instance side of the UI.

Needle A simple needle showing the compass direction is used by default. To change the needle shape, define a method on your UI that returns a Geometric -- usually a Polyline -- that gives the shape of the needle. Add the method name to the Needle property using the properties tool for the widget; this method is a resource and can appear on either the class or instance side of the UI.

The compass widget models the direction in radians, with East being 0 radians and the value increasing in the clockwise direction. This convention is arguably wrong -- North is conventionally 0 and degrees or mills are usually used -- but is convenient from a programmer's point of view.

15-Feb-2003 Doug Palmer