![]() |
ActiveTcl User Guide
|
![]() |
iwidgets::entryfield - Create and manipulate a entry field widget
iwidgets::entryfield pathName ?options?
itk::Widget <- iwidgets::LabeledWidget <- iwidgets::Entryfield
background borderWidth cursor exportSelection
options.
options.
inherited options.
s, e, or w. The default is e.
key press event.
which is the default, denotes no limit. The value is the maximum number of chars the user may type into the field, regardles of field width. For example, if the field width is set to 20 and the fixed value is 10, the user will only be able to type 10 characters into the field which is 20 characters long.
invalid input. The default is bell.
may be given in any of the forms acceptable to Tk_GetFont.
entryfield. Valid values are 0 (disabled) or 1 (enabled).
nism. Standard character validation such as numeric, alphabetic, integer, hexidecimal, real, and alphanumeric can be handled through the use of keywords. Should more extensive validation be necessary, the value may contain the name of a command script.
for invalid. If false is returned, then the procedure associated
with the invalid option will be invoked. If the validation script
contains any % characters, then the script will not be
executed directly. Instead, a new script will be generated by
replacing each %, and the character following it, with
informa- tion from the entryfield. The replacement depends on the
charac- ter following the %, as defined in the list below.
%c
%P
the latest keystoke. This is equivalent to peeking at the future
contents, enabling rejection prior to the update. %S
latest keystroke being added.
%W
_________________________________________________________________
widget with an optional associated label. Addtional options sup- port validation and establishing a upper limit on the number of characters which may be entered in the field.
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 ...?
delete get icursor index insert scan selection xview
ods.
pathName cget option
option. Option may have any of the values accepted
by the iwid- gets::entryfield command.
pathName childsite
pathName clear
pathName configure ?option? ?value option value ...?
option is specified, returns a list describing all of the avail- able 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 command returns an empty string. Option may have any of the values accepted by the iwidgets::entryfield command.
field. See the «frame» widget manual entry for
details on the efchildsite component item.
and display. See the «entry» widget manual entry for details on the entry component item.
package require Iwidgets 4.0
option add *textBackground white
proc returnCmd {} {
puts stdout «Return Pressed"
}
proc invalidCmd {} {
puts stdout «Alphabetic contents invalid" }
iwidgets::entryfield .ef -command returnCmd
iwidgets::entryfield .fef -labeltext «Fixed:» -fixed 10 -width 12
iwidgets::entryfield .nef -labeltext «Numeric:» -validate numeric -width 12
iwidgets::entryfield .aef -labeltext «Alphabetic:» \ -validate alphabetic -width 12 -invalid invalidCmd
iwidgets::entryfield .pef -labeltext «Password:» \ -show 267 -width 12 -command returnCmd
iwidgets::Labeledwidget::alignlabels .ef .fef .nef .aef .pef
pack .ef -fill x -expand yes -padx 10 -pady 5 pack .fef -fill x -expand yes -padx 10 -pady 5 pack .nef -fill x -expand yes -padx 10 -pady 5 pack .aef -fill x -expand yes -padx 10 -pady 5 pack .pef -fill x -expand yes -padx 10 -pady 5
entryfield, widget