qgettext - input dialog for text
Name
qgettext — input dialog for text
Syntax
qgettext caption label [inititial text]
Description
The qgettext command displays a text-input dialog. The dialog contains a text entry field, an OK and a Cancel button. Extra arguments may be given to provide the dialog with an initial text.
The command returns the contents of the text field or an empty string, depending on whether the user clicked the OK button or the Cancel button, respectively.
The text dialog is modal therefore 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 text
This text will appear in the input area when the dialog is displayed. The purpose of this text is to provide a default answer or give the user a hint as to which input to provide.
Examples
Ex.1: Text input dialog
set t [qgettext "New Name" "Enter Name :" John]
In the example script shown above a text input dialog is displayed asking the user for his/her name. The result is assigned to the variable 't'. If the Cancel is pushed an empty string is returned, regardless of the contents of the text field.