A hwtk::inputdialog implements a modal dialog to ask user for a value. It displays a
label and/or image, and an editor based on input type. Will return the value when OK is
pressed.
Format
hwtk::inputdialog - pathName ?option value? …
Standard Options
- -clientdata
- Database name: clientData
- Database class: ClientData
- Acts as a data storage for a widgets. User can store any data and this
will not have any effect on widget property.
- -cursor
- Database name: cursor
- Database class: Cursor
- Specifies the mouse cursor to be used for the widget. See
Tk_GetCursor and cursors(n) in the Tk
reference manual for the legal values. If set to the empty string (the
default), the cursor is inherited from the parent widget.
- -image
- Database name: image
- Database class: Image
- Specifies an image to display in the widget, which must have been
created with the image create command. Typically, if the image option is
specified then it overrides other options that specify a bitmap or
textual value to display in the widget, though this is controlled by the
compound option; the image option may be reset to an empty string to
re-enable a bitmap or text display.
- -text
- Database name: text
- Database class: Text
- Specifies a string to be displayed inside the widget. The way in which
the string is displayed depends on the particular widget and may be
determined by other options, such as anchor or justify.
Widget Specific Options
- -buttonboxpos
- Database name: buttonBoxPos
- Database class: Position
-
The position of the command button toolbar. Valid options are
n, s, e, and
w. Default position is s.
- -destroyonunpost
- Database name: destroyonunpost
- Database class: DestroyOnUnpost
- Specifies whether or not the dialog should be destroyed when unposted.
Acceptable values are 1 and 0.
- -initialvalue
- Database name: initialValue
- Database class: InitialValue
- This is the initial value assigned to the editor. The default is an empty
string.
- -inputtype
- Database name: inputType
- Database class: InputType
- May be set to one of str, uint,
int, real, combobox,
intcheck, boolcheck,
intcolor, rgbcolor,
fileopen, or filesave. This option
sets the editor to be used to process user value. The default is
str.
- -title
- Database name: title
- Database class: Title
- Specifies a string to display as the title of the dialog box. If this
option is not specified, then a default title will be displayed.
- -parent
- Database name: parent
- Database class: Parent
- Makes window the logical parent of the dialog. The dialog is displayed on
top of its parent window. On Mac OS X, this turns the file dialog into a
sheet attached to the parent window.
- -valuelistcommand
- Database name: valueListCommand
- Database class: ValueListCommand
- Specifies the script that should return the list of values to display in the
input dialog when -inputtype is set to
combobox. Default is empty string.
- -x
- Database name: x
- Database class: X
- Specifies the desired x location of the input dialog on the screen, in
pixels. The value specifies the number of pixels between the left edge of
the screen and the left edge of window’s border. If this option is
configured after the window is posted, you must force the window to repost
by calling $windowname post to update the x
geometry.
- -y
- Database name: y
- Database class: Y
- Specifies the desired y location of the dialog on the screen, in pixels. The
value specifies the number of pixels between the top edge of the screen and
the top edge of window’s border. If this option is configured after the
window is posted, you must force the window to repost by calling
$windowname post to update the y geometry.
Widget Command
The widget is a singleton and its instance is not directly visible by the user.
hwtk::inputdialog command will configure and post the dialog instance, hold by the
framework. Does not support the standard widget commands like
configure, cget.
Example
hwtk::inputdialog -title "Input Dialog"
Note: Command will return only when dialog is unposted.
proc retValues {args} {return list "item a" "item b" "item c"] {
hwtk::inputdialog -title "Input Dialog" /
-image add-24.png -text "Choose the items to add:" /
-inputtype combobox -valuelistcommand retValues