hwtk::dialog
Create a dialog box.
Format
hwtk::dialog - pathName ?option value? …
Description
A dialog box is a transient toplevel window containing a recess area for users to place widgets, and a row of configurable command buttons which include the standard Ok, Apply and Cancel buttons. When the user presses any of the buttons, an assigned callback function is invoked.
Standard Options
- -clientdata
- Database name: clientData
- -cursor
- Database name: cursor
- -height
- Database name: height
- -width
- Database name: width
Widget Specific Options
- -buttonboxpos
- Database name: buttonBoxPos
- -destroyonunpost
- Database name: destroyonunpost
- -height
- Database name: height
- -minheight
- Database name: minheight
- -minwidth
- Database name: minwidth
- -modality
- Database name: modality
- -padx
- Database name: padX
- -pady
- Database name: padY
- -parent
- Database name: parent
- -propogate
- Database name: propogate
- -remembergeom
- Database name: remembergeom
- -separator
- Database name: separator
- -title
- Database name: title
- -transient
- Database name: transient
- -width
- Database name: width
- -x
- Database name: x
- -y
- Database name: y
Widget Commands
- pathName add ?arg arg...?
- This command adds a new button to the button toolbar in the dialog. The button will by default be added to the last position (rightmost in horizontal toolbar position, bottommost for vertical toolbar position) in the toolbar. If the user wishes to add the button in a different location, they may add the button using the insert command. Options to the add command include -text, -command and -default. The option -text will specify the text to appear on the button. If no -text option is given it will default to the button’s name as given by the first argument after the add command. The -command option specifies the command which is called when the button is invoked and -default may be set to one of normal, active or disabled.
- pathName buttoncget index option
- This option is used to obtain information about the buttons on the dialog’s toolbar. Information for the standard options for the toolbar can be obtained such as -command, -default and -default. The index is the named index given to the button upon creation.
- pathName buttonconfigure index ?arg arg...?
- This option is used to configure information about the buttons on the dialog’s toolbar. The standard options for the toolbar can be set such as -command, -default and -text. The index is the named index given to the button upon creation.
- pathName buttonlist
- Returns a list of buttons which have been added to the dialog by the user.
- pathName cget option
- Returns the current value of the configuration option given by option.
- pathName component ?name?
- Returns the path of a given component of the dialog widget. Options for the component command are dsrecess, message, statusbar, separator, hull, and bbox. Omitting this option from the command will cause the command to simply return the list of component options.
- pathName configure ?option? ?value option value …?
- Query or modify the configuration options of the widget. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
- pathName default ?index?
- In a dialog box, one button may be designated the default button (meaning, roughly, the one that gets invoked when the user presses Enter). Depending on the theme, the default button may be displayed with an extra highlight ring, or with a different border color. This option allows the user to specify the default button. The index specified must be end, ok, cancel or the index name of an existing button. If no index is specified the index of the current default button is returned.
- pathName delete index
- This command deletes a button from the button toolbar in the window. The index specified must be end, ok, cancel or the index name of an existing button. This command destroys the specified button widget, it no longer exists in memory.
- pathName hide index
- Hides the button in the button toolbar at the given button index. This causes the button to be unmapped and forgotten about by the window manager.
- pathName identify element x y
- Returns the name of the element under the point given by x and y, or an empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget. Some widgets accept other identify subcommands.
- pathName insert index newbutton
- Inserts a new button into the button toolbar in the dialog at a location just before the given button index.
- pathName instate statespec ?script?
- Test the widget’s state. If script is not specified, returns 1 if the
widget state matches statespec and 0 otherwise. If script is specified,
equivalent to
if{[pathNameinstatestateSpec]}script
- pathName invoke index
- Invokes the command associated with the button at button index.
- pathName post ?arg arg …?
- Posts the dialog. This causes the dialog to be mapped by the window manager. Optional arguments may be sent to the post command such as force, -height, -width, -x or -y.
- pathName recess
- Returns the path to the dialog’s recess. The recess is the main area of the dialog which will be utilized for user defined widgets.
- pathName show index
- Shows the button in the button toolbar at the given button index. This causes the button to be mapped by the window manager.
- pathName unpost
- Unposts the dialog. This causes the window to be unmapped and forgotten about by the window manager.
- pathName statusmessage message ?type?
- Posts a message to the status bar.
Example
hwtk::dialog .d -title "::hwtk::dialog"
set msg "User must create widgets/sub-windows inside dialog recess area using dialog's 'recess' command."
pack [hwtk::label [.d recess].check1 -text "$msg" -wraplength 3i] -anchor nw
.d post
#::hwtk::dialog