std-getdist


Synopsis

(std-get1dist <msg>)

(std-get2dist <bpt> <msg>)

(std-getdist <flag> <kwd> <msg> <def> <bpt>)

Description

STD-GET1DIST is basically the same as GETDIST with one argument,

STD-GET2DIST the same as GETDIST with two arguments,

STD-GETDIST (full options) simulates (PROGN (INITGET flag kwd)(STD-GET2DIST)) and more.

They use the following enhancements:
msg is nicely formatted.

If a lisp function given at the prompt returns a valid type this one is accepted.

With std-getdist the additional INITGET initialization and default value check may be omitted, thus leading to easier looping code.

The user may enter a number or two points.

If the default argument is given (and it is not nil and the flag contains no bitvalue 1), then empty input is allowed as well.

Arguments

flag: integer, same as the INITGET flag or nil

kwd: a initget-like string or a list of strings or nil

msg: a string to be displayed as a prompt. If nil "\nPoint: " is prompted.

def: a default value or nil.

bpt: a point from which the rubberband is drawn, and if a point is entered, from which the distance is measured or nil. If not nil only one point or a number is required. If nil a number or two points.

Return Value

Same as GETDIST.

Side Effects

Interrupts the program flow, prints the formatted message and waits for user input.

Module

(std-require 'STDINPUT)

Defined in STDINPUT