1iwidgets::entryfield − Create and manipulate a entry field widget
3gets::LabeledWidget <‐ iwidgets::Entryfield
9See the "options" manual entry for details on the standard op‐
10tions.
12See the "entry" manual entry for details on the associated op‐
13tions.
17See the "labeledwidget" class manual entry for details on the in‐
18herited options.
19Name: childSitePos
20Class: Position
21Command‐Line Switch: ‐childsitepos
22Specifies the position of the child site in the entry field: n,
24Name: command
25Class: Command
26Command‐Line Switch: ‐command
27Specifies a Tcl command to be executed upon detection of a Return
28key press event.
29Name: fixed
30Class: Fixed
31Command‐Line Switch: ‐fixed
32Restrict entry to the specified number of chars. A value of 0,
33which is the default, denotes no limit. The value is the maximum
34number of chars the user may type into the field, regardles of
35field width. For example, if the field width is set to 20 and
36the fixed value is 10, the user will only be able to type 10
37characters into the field which is 20 characters long.
38Name: focusCommand
39Class: Command
40Command‐Line Switch: ‐focuscommand
41Specifies a Tcl command to be executed upon reception of focus.
42Name: invalid
43Class: Command
44Command‐Line Switch: ‐invalid
45Specifies a Tcl command to be executed upon determination of in‐
46valid input. The default is bell.
47Name: textBackground
48Class: Background
49Command‐Line Switch: ‐textbackground
50Background color for inside textual portion of the entry field.
51The value may be given in any of the forms acceptable to Tk_Get‐
53Name: textFont
54Class: Font
55Command‐Line Switch: ‐textfont
56Name of font to use for display of text in entryfield. The value
57may be given in any of the forms acceptable to Tk_GetFont.
58Name: pasting
59Class: Behavior
60Command‐Line Switch: ‐pasting
61Option to enable/disable pasting into the entry component of the
62entryfield. Valid values are 0 (disabled) or 1 (enabled). De‐
63faults to 1.
64Name: validate
65Class: Command
66Command‐Line Switch: ‐validate
67The validate option allows specification of a validation mecha‐
68nism. Standard character validation such as numeric, alphabetic,
70through the use of keywords. Should more extensive validation be
71necessary, the value may contain the name of a command script.
72The script should return a boolean value. True for valid, false
73for invalid. If false is returned, then the procedure associated
74with the invalid option will be invoked. If the validation
75script contains any % characters, then the script will not be ex‐
76ecuted directly. Instead, a new script will be generated by re‐
77placing each %, and the character following it, with information
78from the entryfield. The replacement depends on the character
79following the %, as defined in the list below. %c Replaced with
80the current input character. %P Replaced with the contents of
81the entryfield modified to include the latest keystoke. This is
82equivalent to peeking at the future contents, enabling rejection
83prior to the update. %S Replaced with the current contents of
84the entryfield prior to the latest keystroke being added. %W Re‐
85placed with the entryfield widget pathname.
86
87The iwidgets::entryfield command creates an enhanced text entry
88widget with an optional associated label. Addtional options sup‐
89port validation and establishing a upper limit on the number of
90characters which may be entered in the field.
91
92The iwidgets::entryfield command creates a new Tcl command whose
93name is pathName. This command may be used to invoke various op‐
94erations on the widget. It has the following general form: path‐
96act behavior of the command. The following commands are possible
97for entryfield widgets:
100See the "entry" manual entry for details on the associated meth‐
101ods. pathName cget option Returns the current value of the con‐
102figuration option given by option. Option may have any of the
103values accepted by the iwidgets::entryfield command. pathName
107widget. If no option is specified, returns a list describing all
108of the available options for pathName (see Tk_ConfigureInfo for
109information on the format of this list). If option is specified
110with no value, then the command returns a list describing the one
111named option (this list will be identical to the corresponding
112sublist of the value returned if no option is specified). If one
113or more option−value pairs are specified, then the command modi‐
114fies the given widget option(s) to have the given value(s); in
115this case the command returns an empty string. Option may have
116any of the values accepted by the iwidgets::entryfield command.
117
118Name: efchildsite
119Class: frame
120The efchildsite component is the user child site for the entry
121field. See the "frame" widget manual entry for details on the
122efchildsite component item.
123Name: entry
124Class: entry
125The entry component provides the entry field for user text input
126and display. See the "entry" widget manual entry for details on
127the entry component item.
128
129 package require Iwidgets 4.0
130 option add *textBackground white
131
132 proc returnCmd {} {
133 puts stdout "Return Pressed"
134 }
135
136 proc invalidCmd {} {
137 puts stdout "Alphabetic contents invalid"
138 }
139
140 iwidgets::entryfield .ef ‐command returnCmd
141
142 iwidgets::entryfield .fef ‐labeltext "Fixed:" ‐fixed 10 ‐width
14312
144
145 iwidgets::entryfield .nef ‐labeltext "Numeric:" ‐validate numer‐
146ic ‐width 12
147
148 iwidgets::entryfield .aef ‐labeltext "Alphabetic:" \
149 ‐validate alphabetic ‐width 12 ‐invalid invalidCmd
150
151 iwidgets::entryfield .pef ‐labeltext "Password:" \
152 ‐show 267 ‐width 12 ‐command returnCmd
153
154 iwidgets::Labeledwidget::alignlabels .ef .fef .nef .aef .pef
155
156 pack .ef ‐fill x ‐expand yes ‐padx 10 ‐pady 5
157 pack .fef ‐fill x ‐expand yes ‐padx 10 ‐pady 5
158 pack .nef ‐fill x ‐expand yes ‐padx 10 ‐pady 5
159 pack .aef ‐fill x ‐expand yes ‐padx 10 ‐pady 5
160 pack .pef ‐fill x ‐expand yes ‐padx 10 ‐pady 5 Sue Yockey Mark
161L. Ulferts entryfield, widget
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198