mentry::mentry
- Create and manipulate multi-entry widgets
mentry::mentry pathName ?options?
-borderwidth -highlightcolor -relief -highlightbackground -highlightthickness
-background -cursor -font -foreground
-exportselection -insertwidth -selectforeground -insertbackground -invalidcommand -show -insertborderwidth -justify -state -insertofftime -selectbackground -validate -insertontime -selectborderwidth -validatecommand
-body
{width ?text width text ...?}
-disabledbackground
color
-disabledforeground
color
-readonlybackground
color
-takefocus
0|1|""|command
-textvariable
array
pathName attrib
?name? ?value name value ...?
pathName cget
option
pathName clear
first ?last?
pathName configure
?option? ?value option value ...?
pathName entries
pathName entrycount
pathName entrylimit
index
pathName entrypath
index
pathName getarray
array
pathName getlist
pathName getstring
pathName isempty
?index?
pathName isfull
?index?
pathName labelcount
pathName labelpath
index
pathName labels
pathName put
startIndex ?string string ...?
mentry::mentry
- Create and manipulate multi-entry widgets
mentry::mentry pathName ?options?
-borderwidth -highlightcolor -relief -highlightbackground -highlightthickness
-background -cursor -font -foreground
configure
subcommand of the Tcl command
corresponding to that child.
-exportselection -insertwidth -selectforeground -insertbackground -invalidcommand -show -insertborderwidth -justify -state -insertofftime -selectbackground -validate -insertontime -selectborderwidth -validatecommand
configure
subcommand of the Tcl command
corresponding to that entry. The
-invalidcommand
, -validate
, and
-validatecommand
options are only supported if Tk
version 8.3 or higher is used, because the options with the same names
for entry widgets were introduced in Tk 8.3.
Command-Line Name: | -body
|
Database Name: | body
|
Database Class: | Body
|
Specifies the initial widths of the entry children of the given multi-entry widget, as well as the texts to be displayed in the labels separating the entries. The value of this option is viewed as a list. Each odd-numbered element is interpreted as the value of the
-width
configuration option of an entry child, while each even-numbered element represents the value of the-text
configuration option of a label child. The order of the list elements determines the creation order of the child widgets; these will be packed in a row, without any horizontal padding. The initial width of each entry child also determines the number of elements that can be inserted into it; this maximal length remains unchanged even if the width of the entry is set to a new value later on. The width of an entry child and the text displayed in a label may be changed by using theconfigure
subcommand of the Tcl command corresponding to that child.
Command-Line Name: | -disabledbackground
|
Database Name: | disabledBackground
|
Database Class: | DisabledBackground
|
This option, which is only supported for Tk versions 8.4 or higher, specifies the background color to use for all entry and label children of the given multi-entry widget when it is disabled. If the value of this option is the empty string then the normal background color is used.
Command-Line Name: | -disabledforeground
|
Database Name: | disabledForeground
|
Database Class: | DisabledForeground
|
This option, which is only supported for Tk versions 8.4 or higher, specifies the foreground color to use for all entry and label children of the given multi-entry widget when it is disabled. If the value of this option is the empty string then the normal foreground color is used.
Command-Line Name: | -readonlybackground
|
Database Name: | readonlyBackground
|
Database Class: | ReadonlyBackground
|
This option, which is only supported for Tk versions 8.4 or higher, specifies the background color to use for all entry and label children of the given multi-entry widget when it is readonly. If the value of this option is the empty string then the normal background color is used.
Command-Line Name: | -takefocus
|
Database Name: | takeFocus
|
Database Class: | TakeFocus
|
This option determines whether the widget accepts the focus during keyboard traversal. It is almost identical to the standard option with the same name (see the options manual entry for details). The only difference is that not the widget itself but its first enabled entry child will receive the focus during keyboard traversal with the standard keys (
Tab
andShift-Tab
). See the DEFAULT BINDINGS section below for information on how to move the focus from one entry child to another using the keyboard.
Command-Line Name: | -textvariable
|
Database Name: | textvariable
|
Database Class: | Variable
|
If the value of this option is not an empty string then it must be an array. In this case, for each entry child of the given multi-entry widget the value of the array element with the index of the entry as element name specifies the value of the
-textvariable
option for that entry. The entry indices start with0
. For example, specifying-textvariable arr
for a multi-entry widget having two entry children is equivalent to specifying-textvariable arr(0)
for the first and-textvariable arr(1)
for the second entry child of that widget.
mentry::mentry
command creates a new window
named pathName
and of the class
Mentry
, and makes it into a mentry
widget. Additional options, described above, may be specified on
the command line or in the option database to configure aspects of the
mentry such as its colors, font, and children. The
mentry::mentry
command returns its
pathName
argument. At the time this command
is invoked, there must not exist a window named
pathName
, but pathName
's parent
must exist.
-body
configuration option)
also determines the maximal number of characters that can be inserted
into it. This is achieved with the aid of the wcb::callback
command, by
registering the wcb::checkEntryLen
before-insert
callback with the entry child.
In order to keep this callback, additional
before-insert
callbacks (if needed) should only be
registered with the wcb::cbappend
and wcb::cbprepend
commands. When reaching this limit in an entry having the input
focus, the latter is set automatically to the next enabled entry child,
the contents of that widget is selected, and the insertion cursor is
set to its end. This is made sure by defining an appropriate
after-insert
callback, which must be kept to be the
last such callback for the entry. For this reason, additional
after-insert
callbacks (if needed) should only be
registered with the wcb::cbprepend
command.
The same command should be used exclusively to define
after-motion
callbacks (if needed), because
mentry::mentry
registers one that must be the last
after-motion
callback for each entry child.
mentry::dateMentry
command has a type
attribute having the value
"Date"
and a format
attribute
specifying the meanings of its components. The values of these
attributes are queried and used in the bodies of the procedures
mentry::putClockVal
and mentry::getClockVal
.
mentry::mentry
command creates a new Tcl
command whose name is pathName
. This
command may be used to invoke various operations on the
widget. It has the following general form:
pathName option ?arg arg ...?
option
and the arg
s
determine the exact behavior of the command.
number
| Specifies the child as a numerical index, where 0
corresponds to the first entry or label child. |
end
| Indicates the last entry or label child of the mentry. |
end
can be abbreviated as
en
or e
. Out-of-range
indices are automatically rounded to the nearest legal value.
pathName attrib ?name? ?value
name value ...?
name
is specified, the command returns a list
of pairs, each of which contains the name and the value of an
attribute for pathName
. If
name
is specified with no
value
, then the command returns the value of
the one named attribute. If one or more
name
-value
pairs are
specified, then the command sets the given widget attribute(s) to
the given value(s); in this case the return value is an empty
string. name
may be an arbitrary
string.
pathName cget option
option
, which may have any of the values
accepted by the mentry::mentry
command.
pathName clear first
?last?
first
and
last
are indices specifying the first and
last entries in the range to clear. If
last
is not specified then it defaults to
first
, i.e., a single entry child is
cleared. The return value is an empty string.
pathName configure ?option?
?value option value ...?
option
is specified, the
command returns a list describing all of the available options
for pathName
(see
Tk_ConfigureInfo
for information on the
format of this list). If option
is
specified with no value
, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if
no option
is specified). 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 return value is an
empty string. option
may have any of
the values accepted by the mentry::mentry
command.
pathName entries
pathName entrycount
pathName entrylimit index
index
.
pathName entrypath index
index
.
pathName getarray array
array
having the index of the entry as
element name. The entry indices start with
0
. The return value is an empty string.
pathName getlist
pathName getstring
-body
configuration option. That is,
the string of the first entry child is followed by the text of
the first label, which in turn is followed by the string of the
second entry, and so on.
pathName isempty ?index?
index
is specified then the command
returns the value 1
if the string contained in the
entry child identfied by index
is empty and
0
otherwise. If this optional argument is not
present then the command returns the value 1
if the
strings contained in the entry children of the widget are all
empty and 0
otherwise.
pathName isfull ?index?
index
is specified then the command
returns the value 1
if the length of the string
contained in the entry child identfied by
index
equals the number of characters that
can be inserted into the entry and 0
otherwise. If this optional argument is not present then
the command returns the value 1
if the lengths of
the strings contained in the entry children of the widget all
equal the numbers of characters that can be inserted into the
respective entries (i.e., if all entry children are full) and
0
otherwise.
pathName labelcount
pathName labelpath index
index
.
pathName labels
pathName put startIndex ?string
string ...?
startIndex
with the
corresponding string
arguments by using the
delete
and insert
operations, until either the entries or the
string
s are consumed. If one of these
subcommands gets canceled by some before-callback in any entry
child then the command restores the original contents of all
affected entries and returns the value 0
, otherwise
it returns 1
. In both cases, the command keeps
the position of the insertion cursor in all entry children.
mentry::mentry
command partially redefines the
bindings of the children of the mentry widget it creates:
Left
key clears the
selection in that entry, moves the focus to the previous enabled
entry child, and sets the insertion cursor to the end of that
widget. Similarly, at the end of an entry child that is not
the last enabled entry within the widget, the Right
key clears the selection in that entry, moves the focus to the
next enabled entry child, and sets the insertion cursor to the
beginning of that widget. If
tk_strictMotif
is false then
Control-b
and Control-f
behave the same
as Left
and Right
, respectively.
Control-Left
moves the focus to the previous
enabled entry child, selects the contents of that widget, and
sets the insertion cursor to its end; if there is no enabled
entry child to the left of the current one then
Control-Left
moves the insertion cursor to the
beginning of the current entry and clears the selection in that
widget. Similarly, in an entry child that is not the last
enabled entry within the widget, Control-Right
moves
the focus to the next enabled entry child, selects the contents
of that widget, and sets the insertion cursor to its end; if
there is no enabled entry child to the right of the current one
then Control-Right
moves the insertion cursor to the
end of the current entry and clears the selection in that
widget. If tk_strictMotif
is false then
Meta-b
and Meta-f
behave the same as
Control-Left
and Control-Right
,
respectively.
Home
key clears the selection in the current
entry widget, moves the focus to the first enabled entry child,
and sets the insertion cursor to the beginning of that
widget. Similarly, the End
key clears the
selection in the current entry widget, moves the focus to the
last enabled entry child, and sets the insertion cursor to the
end of that widget. If tk_strictMotif
is false then Control-a
and Control-e
behave the same as Home
and End
,
respectively.
Shift-Home
moves the focus to the first enabled
entry child, sets the insertion cursor to the beginning of that
widget, and either extends the selection to that position, or
clears the selection in the current entry and selects the
contents of the new widget, depending upon whether the current
entry is the first enabled entry child or not. Similarly,
Shift-End
moves the focus to the last enabled entry
child, sets the insertion cursor to the end of that widget, and
either extends the selection to that position, or clears the
selection in the current entry and selects the contents of the
new widget, depending upon whether the current entry is the last
enabled entry child or not.
BackSpace
key deletes the selection if there is
one in the current entry. Otherwise, it deletes either the
character to the left of the insertion cursor in the current
entry, or the last character of the previous enabled entry
child. The latter takes place at the beginning of an entry
child that is not the first enabled entry within the widget; in
this case, the BackSpace
key also moves the focus to
the previous enabled entry child and sets the insertion cursor to
its end. If tk_strictMotif
is false
then Control-h
behaves the same as
BackSpace
.
tk_strictMotif
is false then
Meta-d
deletes all characters to the right of the
insertion cursor within the current entry, while
Meta-BackSpace
and Meta-Delete
delete
either all characters to the left of the insertion cursor in the
current entry, or the contents of the previous enabled entry
child. The latter takes place at the beginning of an entry
child that is not the first enabled entry within the widget; in
this case, Meta-BackSpace
and
Meta-Delete
also clear the selection in the current
entry widget and move the focus to the previous enabled entry
child.