qgetinteger - input dialog for integers

Name

qgetinteger — input dialog for integers

Syntax

qgetinteger caption label initialvalue [step]

Description

The qgetinteger command displays a dialog for integer input. The dialog contains an entry field and OK and Cancel buttons. The user may change the input number either by editing the entry field directly or by clicking on the associated up and down arrows. Extra arguments may be given to provide the dialog with a description label, an initial value, and a step size used when clicking on the increment/decrement arrows.

The command returns either the number entered by the user or an empty string if Cancel is pressed.

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

Arguments

caption

Dialog title.

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, providing a default answer.

step

The amount by which the number in the entry field will change when the user clicks on the up or down arrows.

Examples

Ex.1: Integer input dialog

set i [qgetinteger Title "Please enter number " 10 2]

In the example script shown above an input dialog is displayed asking the user for a number. The result will be assigned to the variable 'i', which could be an empty string if the user presses the Cancel.