Inherits:
::tycho::Dialog
-
Related constructs -
Source File -
Contents:
itk_options
- public methods
- protected variable
Create a dialog window with any number of labeled entry boxes and
radio buttons. These can be specified with the -queries
option or with methods that add individual queries. The
get
method returns a list of values. It is possible to
modify the action taken by the OK and Cancel buttons. Do this using
the -okcommand or -cancelcommand options. The default
value for the -okcommand option is a command that simply
returns the value returned by the get
method. The
default -cancelcommand returns a null string. The return value
of these commands will determine what is returned by the
wait
procedure of the base class Dialog, which is
the usual way for creating a modal dialog.
For examples of the usage of this class, see the
dialog classes tutorial.
The first query created gets the focus, and Control-Tab moves from one
query to the next.
-cancelcommand
- Specify the command to execute on a cancel response.
-entrywidth
40
- Specify the width (in characters) of the entry boxes.
-labelcolor
black
- Specify the color of the labels.
-queries
- The value of the option must be a list of lists, where each list
begins with a method name. The method names currently understood are
"line", "lines", and "radio" for text entries with one line or
multiple lines, and radio buttons, respectively. After the method
name, the arguments to the corresponding method are given.
-okcommand
- Specify the command to execute on an OK response.
-entryforeground
black
- The options used by the entry widgets.
-entrybackground
white
-
-entryfont
8x13
-
Public constructs
-
check
tag label default args
- Add a check button query. The arguments are:
The additional
arguments can be used to pass tk
checkbutton
options
such as -command
. Typical usage is:
::tycho::Query .e
.e check foo {My Foo:} 0 -command {puts foo}
.e centerOnScreen
If values other than 0 or 1 are needed, supply the -onvalue and
-offvalue options.
-
choice
tag label entries default {command {}}
- Add an option menu query. The arguments are:
NOTE: If a modal dialog is created with a "choice" query, then it
must have the auto-raise feature disabled. This can be accomplished
by calling
::tycho::Dialog::wait
with the optional second
argument given as "0". For example,
::tycho::Query .e
.e choice foo {My Foo:} {a b c} a
::tycho::Dialog::wait .e 0
.
-
clear
{tag {}}
- If no argument is given, clear the all widgets. If a tag
is given as an argument, clear the corresponding widget. If the tag is
not recognized, do nothing. What it means to clear a widget depends
on the widget. In some cases, it resets the initial default value.
In the case of entry widgets, it deletes the current entry.
-
disable
tag
- Disable user interaction with a query.
-
enable
tag
- Enable user interaction with a query. Queries are enabled by default,
so this is only needed if a query has been explicitly disabled.
-
focusin
- Give the focus to the appropriate subwindow, if there is one.
If queries are being added dynamically using
addTextQuery
or
addRadioQuery
, then the most recently added query will
get the focus. Otherwise, the first query gets the focus.
-
get
{tag {}}
- If no argument is given, get the current value of the queries,
and return as a list in the form {tag value tag value ...}. This list
can be directly assigned to an array using
array set
,
making it easy to use the results of the query. If a tag is given as an
argument, return the value of the corresponding query only. If the tag
is not recognized, return an empty string.
-
insert
tag str
- Insert the specified string into the specified query.
What this means depends on the type of query.
If the tag is not recognized, flag an error.
-
line
tag label default args
- Add an entry box query (a single-line text entry). The arguments are:
A Tk
entry
widget is used for the query.
-
lines
tag label default lines args
- Add a multi-line edit box query. The arguments are:
An
Edit
widget is used for the query, providing an
emacs-like text editor.
-
mediated
tag label default command args
- Add a mediated query (a button that invokes some other widget).
The arguments are:
Before the command is invoked, the current value of the query
is appended to the end, separated by a space. The command
should return the new value. If the command returns a null string,
then no change is made to the current value of the query.
-
mediatedCommand
tag command
- Invoke the command of a mediated query. If it returns a non-null string,
then set the text of the appropriate button to that string.
The arguments are:
Before the command is invoked, the current value of the query
is appended to the end, separated by a space.
-
ok
- Execute the -okcommand command and close the window.
-
radio
tag label bttnNames default args
- Add a radio button query. The arguments are:
The additional
arguments can be used to pass tk
radiobutton
options
such as -command
. Typical usage is:
::tycho::Query .e
.e radio foo {My Foo:} {a b c} a -command {puts foo}
.e centerOnScreen
.
-
remove
tag
- Remove the query identified by the specified tag.
Protected constructs
-
numentries
0
- Remember the number of entries currently in this widget.
Index of classes
Author: Edward A. Lee, Joel R. King, Bilung Lee, John Reekie
Contributor: Christopher Hylands
Version: @(#)Query.itcl 1.16 12/04/96
Copyright: (c) 1995-1996 The Regents of the University of California.