beetlebug▾
/

ztcl::location watch

Runs a script at each move.

ztcl::location watch ?-accuracy best|balanced|low? ?-distance M? ?-interval MS? -command SCRIPT

Description

Gives a handle, and runs SCRIPT with the dict of a position appended at each new position, from the event loop, as get does. An error, such as {error denied}, ends the handle.

-distance M gives the least move in meters between two positions, and -interval MS the least time between two of them, where the platform has it. While a watch is active, the event loop wakes at least every 20 milliseconds, since the host gives the positions from its own thread. The interpreter stops each watch when it ends.

Returns

A handle, such as location1.

Examples

% catch {ztcl::location watch -distance 10 -command puts} msg; set msg
the location is not available on this platform

Errors

% ztcl::location watch -distance -1 -command puts
bad distance "-1": must be 0 to 10000000 meters
-errorcode ZTCL LOCATION VALUE

% ztcl::location watch -timeout 5 -command puts
bad option "-timeout": must be -accuracy, -command, -distance, or -interval
-errorcode NONE

Facts

Capability
location. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.6

See also