qgetdouble - input dialog for decimal numbers

Name

*qgetdouble — input dialog for decimal numbers

Syntax

qgetdouble caption label initialvalue

Description

The qgetdouble command displays a dialog for double precision numberical input. The dialog contains an entry field, OK and Cancel buttons. Extra arguments provide the dialog with a caption, a descriptive label, and an initial value.

The command returns either the number entered by the user or, when Cancel is pushed, an empty string "".

The dialog is modal, meaning script execution is halted until the user closes the dialog.

Arguments

label

Read-only text to appear above the input area. This text typically explains the purpose of the dialog.

initial value

This number will appear in the input area when the dialog is displayed, thus providing a default answer.

Examples

Ex.1: Numerical input dialog

# Ask user for a number, suggesting 100 as initial value
set d [qgetdouble "Get Double" "Please Enter number" 100]

In the example script shown above an input dialog is displayed asking the user for a number. The chosen number will be assigned to the variable 'd', or, if the user pressed Cancel, an empty string.