1 |
578 |
markom |
<HTML>
|
2 |
|
|
<HEAD>
|
3 |
|
|
<TITLE>iwidgets2.2.0 User Commands - entryfield</TITLE>
|
4 |
|
|
</HEAD>
|
5 |
|
|
<BODY BGCOLOR="#FFFFFF">
|
6 |
|
|
<H1>iwidgets2.2.0 User Commands - entryfield</H1>
|
7 |
|
|
<HR>
|
8 |
|
|
<PRE>
|
9 |
|
|
|
10 |
|
|
</PRE>
|
11 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
</PRE>
|
15 |
|
|
<H2>NAME</H2><PRE>
|
16 |
|
|
entryfield - Create and manipulate a entry field widget
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
</PRE>
|
20 |
|
|
<H2>SYNOPSIS</H2><PRE>
|
21 |
|
|
<STRONG>entryfield</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
</PRE>
|
25 |
|
|
<H2>INHERITANCE</H2><PRE>
|
26 |
|
|
itk::Widget <- LabeledWidget <- entryfield
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
</PRE>
|
30 |
|
|
<H2>STANDARD OPTIONS</H2><PRE>
|
31 |
|
|
<STRONG>background</STRONG> <STRONG>borderWidth</STRONG> <STRONG>cursor</STRONG> <STRONG>exportSelection</STRONG>
|
32 |
|
|
<STRONG>foreground</STRONG> <STRONG>highlightColor</STRONG> <STRONG>highlightThicknessinsertBackground</STRONG>
|
33 |
|
|
<STRONG>insertBorderWidth</STRONG> <STRONG>insertOffTime</STRONG> <STRONG>insertOnTimeinsertWidth</STRONG>
|
34 |
|
|
<STRONG>justify</STRONG> <STRONG>relief</STRONG> <STRONG>selectBackgroundselectBorderWidth</STRONG>
|
35 |
|
|
<STRONG>selectForeground</STRONG> <STRONG>textVariable</STRONG> <STRONG>width</STRONG>
|
36 |
|
|
|
37 |
|
|
See the "options" manual entry for details on the standard
|
38 |
|
|
options.
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
</PRE>
|
42 |
|
|
<H2>ASSOCIATED OPTIONS</H2><PRE>
|
43 |
|
|
<STRONG>show</STRONG> <STRONG>state</STRONG>
|
44 |
|
|
|
45 |
|
|
See the "entry" manual entry for details on the associated
|
46 |
|
|
options.
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
</PRE>
|
50 |
|
|
<H2>INHERITED OPTIONS</H2><PRE>
|
51 |
|
|
<STRONG>labelBitmap</STRONG> <STRONG>labelFont</STRONG> <STRONG>labelImage</STRONG> <STRONG>labelMargin</STRONG>
|
52 |
|
|
<STRONG>labelPos</STRONG> <STRONG>labelText</STRONG> <STRONG>labelVariable</STRONG>
|
53 |
|
|
|
54 |
|
|
See the "labeledwidget" class manual entry for details on
|
55 |
|
|
the inherited options.
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
</PRE>
|
59 |
|
|
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
|
60 |
|
|
Name: <STRONG>childSitePos</STRONG>
|
61 |
|
|
Class: <STRONG>Position</STRONG>
|
62 |
|
|
Command-Line Switch: <STRONG>-childsitepos</STRONG>
|
63 |
|
|
|
64 |
|
|
Specifies the position of the child site in the entry
|
65 |
|
|
field: <STRONG>n</STRONG>, <STRONG>s</STRONG>, <STRONG>e</STRONG>, or <STRONG>w</STRONG>. The default is e.
|
66 |
|
|
|
67 |
|
|
Name: <STRONG>command</STRONG>
|
68 |
|
|
Class: <STRONG>Command</STRONG>
|
69 |
|
|
Command-Line Switch: <STRONG>-command</STRONG>
|
70 |
|
|
|
71 |
|
|
Specifies a Tcl command to be executed upon detection
|
72 |
|
|
of a Return key press event.
|
73 |
|
|
|
74 |
|
|
Name: <STRONG>fixed</STRONG>
|
75 |
|
|
Class: <STRONG>Fixed</STRONG>
|
76 |
|
|
Command-Line Switch: <STRONG>-fixed</STRONG>
|
77 |
|
|
Restrict entry to the specified number of chars. A
|
78 |
|
|
value of 0, which is the default, denotes no limit.
|
79 |
|
|
The value is the maximum number of chars the user may
|
80 |
|
|
type into the field, regardles of field width. For
|
81 |
|
|
example, if the field width is set to 20 and the fixed
|
82 |
|
|
value is 10, the user will only be able to type 10
|
83 |
|
|
characters into the field which is 20 characters long.
|
84 |
|
|
|
85 |
|
|
Name: <STRONG>focusCommand</STRONG>
|
86 |
|
|
Class: <STRONG>Command</STRONG>
|
87 |
|
|
Command-Line Switch: <STRONG>-focuscommand</STRONG>
|
88 |
|
|
|
89 |
|
|
Specifies a Tcl command to be executed upon reception
|
90 |
|
|
of focus.
|
91 |
|
|
|
92 |
|
|
Name: <STRONG>invalid</STRONG>
|
93 |
|
|
Class: <STRONG>Command</STRONG>
|
94 |
|
|
Command-Line Switch: <STRONG>-invalid</STRONG>
|
95 |
|
|
|
96 |
|
|
Specifies a Tcl command to be executed upon determina-
|
97 |
|
|
tion of invalid input. The default is bell.
|
98 |
|
|
|
99 |
|
|
Name: <STRONG>textBackground</STRONG>
|
100 |
|
|
Class: <STRONG>Background</STRONG>
|
101 |
|
|
Command-Line Switch: <STRONG>-textbackground</STRONG>
|
102 |
|
|
|
103 |
|
|
Background color for inside textual portion of the
|
104 |
|
|
entry field. The value may be given in any of the
|
105 |
|
|
forms acceptable to <STRONG>Tk_GetColor</STRONG>.
|
106 |
|
|
|
107 |
|
|
Name: <STRONG>textFont</STRONG>
|
108 |
|
|
Class: <STRONG>Font</STRONG>
|
109 |
|
|
Command-Line Switch: <STRONG>-textfont</STRONG>
|
110 |
|
|
|
111 |
|
|
Name of font to use for display of text in entryfield.
|
112 |
|
|
The value may be given in any of the forms acceptable
|
113 |
|
|
to <STRONG>Tk_GetFont</STRONG>.
|
114 |
|
|
|
115 |
|
|
Name: <STRONG>validate</STRONG>
|
116 |
|
|
Class: <STRONG>Command</STRONG>
|
117 |
|
|
Command-Line Switch: <STRONG>-validate</STRONG>
|
118 |
|
|
|
119 |
|
|
The validate option allows specification of a valida-
|
120 |
|
|
tion mechanism. Standard character validation such as
|
121 |
|
|
<STRONG>numeric</STRONG>, <STRONG>alphabetic</STRONG>, <STRONG>integer</STRONG>, <STRONG>hexidecimal</STRONG>, <STRONG>real</STRONG>, and
|
122 |
|
|
<STRONG>alphanumeric</STRONG> can be handled through the use of key-
|
123 |
|
|
words. Should more extensive validation be necessary,
|
124 |
|
|
the value may contain the name of a command script.
|
125 |
|
|
The script should return a boolean value. True for
|
126 |
|
|
valid, false for invalid. If false is returned, then
|
127 |
|
|
the procedure associated with the invalid option will
|
128 |
|
|
be invoked. If the validation script contains any <STRONG>%</STRONG>
|
129 |
|
|
characters, then the script will not be executed
|
130 |
|
|
directly. Instead, a new script will be generated by
|
131 |
|
|
replacing each <STRONG>%</STRONG>, and the character following it, with
|
132 |
|
|
information from the entryfield. The replacement
|
133 |
|
|
depends on the character following the <STRONG>%</STRONG>, as defined in
|
134 |
|
|
the list below.
|
135 |
|
|
|
136 |
|
|
<STRONG>%c</STRONG> Replaced with the current input character.
|
137 |
|
|
|
138 |
|
|
<STRONG>%P</STRONG> Replaced with the contents of the entryfield modified
|
139 |
|
|
to include the latest keystoke. This is equivalent to
|
140 |
|
|
peeking at the future contents, enabling rejection
|
141 |
|
|
prior to the update.
|
142 |
|
|
|
143 |
|
|
<STRONG>%S</STRONG> Replaced with the current contents of the entryfield
|
144 |
|
|
prior to the latest keystroke being added.
|
145 |
|
|
|
146 |
|
|
<STRONG>%W</STRONG> Replaced with the entryfield widget pathname.
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
</PRE>
|
150 |
|
|
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
</PRE>
|
155 |
|
|
<H2>DESCRIPTION</H2><PRE>
|
156 |
|
|
The <STRONG>entryfield</STRONG> command creates an enhanced text entry widget
|
157 |
|
|
with an optional associated label. Addtional options sup-
|
158 |
|
|
port validation and establishing a upper limit on the number
|
159 |
|
|
of characters which may be entered in the field.
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
</PRE>
|
165 |
|
|
<H2>METHODS</H2><PRE>
|
166 |
|
|
The <STRONG>entryfield</STRONG> command creates a new Tcl command whose name
|
167 |
|
|
is <EM>pathName</EM>. This command may be used to invoke various
|
168 |
|
|
operations on the widget. It has the following general
|
169 |
|
|
form:
|
170 |
|
|
|
171 |
|
|
<EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
|
172 |
|
|
|
173 |
|
|
<EM>Option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
|
174 |
|
|
mand. The following commands are possible for entryfield
|
175 |
|
|
widgets:
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
</PRE>
|
179 |
|
|
<H2>ASSOCIATED METHODS</H2><PRE>
|
180 |
|
|
<STRONG>delete</STRONG> <STRONG>get</STRONG> <STRONG>icursor</STRONG> <STRONG>index</STRONG>
|
181 |
|
|
<STRONG>insert</STRONG> <STRONG>scan</STRONG> <STRONG>selection</STRONG> <STRONG>xview</STRONG>
|
182 |
|
|
|
183 |
|
|
See the "entry" manual entry for details on the associated
|
184 |
|
|
methods.
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
</PRE>
|
188 |
|
|
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
|
189 |
|
|
<EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
|
190 |
|
|
Returns the current value of the configuration option
|
191 |
|
|
given by <EM>option</EM>. <EM>Option</EM> may have any of the values
|
192 |
|
|
accepted by the <STRONG>entryfield</STRONG> command.
|
193 |
|
|
|
194 |
|
|
<EM>pathName</EM> <STRONG>childsite</STRONG>
|
195 |
|
|
Returns the path name of the child site.
|
196 |
|
|
|
197 |
|
|
<EM>pathName</EM> <STRONG>clear</STRONG>
|
198 |
|
|
Clear entry widget
|
199 |
|
|
|
200 |
|
|
<EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
|
201 |
|
|
Query or modify the configuration options of the
|
202 |
|
|
widget. If no <EM>option</EM> is specified, returns a list
|
203 |
|
|
describing all of the available options for <EM>pathName</EM>
|
204 |
|
|
(see <STRONG>Tk_ConfigureInfo</STRONG> for information on the format of
|
205 |
|
|
this list). If <EM>option</EM> is specified with no <EM>value</EM>, then
|
206 |
|
|
the command returns a list describing the one named
|
207 |
|
|
option (this list will be identical to the correspond-
|
208 |
|
|
ing sublist of the value returned if no <EM>option</EM> is
|
209 |
|
|
specified). If one or more <EM>option</EM> - <EM>value</EM> pairs are
|
210 |
|
|
specified, then the command modifies the given widget
|
211 |
|
|
option(s) to have the given value(s); in this case the
|
212 |
|
|
command returns an empty string. <EM>Option</EM> may have any
|
213 |
|
|
of the values accepted by the <STRONG>entryfield</STRONG> command.
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
</PRE>
|
218 |
|
|
<H2>COMPONENTS</H2><PRE>
|
219 |
|
|
Name: <STRONG>efchildsite</STRONG>
|
220 |
|
|
Class: <STRONG>frame</STRONG>
|
221 |
|
|
|
222 |
|
|
The efchildsite component is the user child site for
|
223 |
|
|
the entry field. See the "frame" widget manual entry
|
224 |
|
|
for details on the efchildsite component item.
|
225 |
|
|
|
226 |
|
|
Name: <STRONG>entry</STRONG>
|
227 |
|
|
Class: <STRONG>entry</STRONG>
|
228 |
|
|
|
229 |
|
|
The entry component provides the entry field for user
|
230 |
|
|
text input and display. See the "entry" widget manual
|
231 |
|
|
entry for details on the entry component item.
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
</PRE>
|
236 |
|
|
<H2>EXAMPLE</H2><PRE>
|
237 |
|
|
option add *textBackground white
|
238 |
|
|
|
239 |
|
|
proc returnCmd {} {
|
240 |
|
|
puts stdout "Return Pressed"
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
proc invalidCmd {} {
|
244 |
|
|
puts stdout "Alphabetic contents invalid"
|
245 |
|
|
}
|
246 |
|
|
|
247 |
|
|
entryfield .ef -command returnCmd
|
248 |
|
|
|
249 |
|
|
entryfield .fef -labeltext "Fixed:" -fixed 10 -width 12
|
250 |
|
|
|
251 |
|
|
entryfield .nef -labeltext "Numeric:" -validate numeric -width 12
|
252 |
|
|
|
253 |
|
|
entryfield .aef -labeltext "Alphabetic:" \
|
254 |
|
|
-validate alphabetic -width 12 -invalid invalidCmd
|
255 |
|
|
|
256 |
|
|
entryfield .pef -labeltext "Password:" \
|
257 |
|
|
-show 267 -width 12 -command returnCmd
|
258 |
|
|
|
259 |
|
|
LabeledWidget::alignLabels .ef .fef .nef .aef .pef
|
260 |
|
|
|
261 |
|
|
pack .ef -fill x -expand yes -padx 10 -pady 5
|
262 |
|
|
pack .fef -fill x -expand yes -padx 10 -pady 5
|
263 |
|
|
pack .nef -fill x -expand yes -padx 10 -pady 5
|
264 |
|
|
pack .aef -fill x -expand yes -padx 10 -pady 5
|
265 |
|
|
pack .pef -fill x -expand yes -padx 10 -pady 5
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
</PRE>
|
270 |
|
|
<H2>AUTHOR</H2><PRE>
|
271 |
|
|
Sue Yockey
|
272 |
|
|
|
273 |
|
|
Mark L. Ulferts
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
</PRE>
|
277 |
|
|
<H2>KEYWORDS</H2><PRE>
|
278 |
|
|
entryfield, widget
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
</PRE>
|
304 |
|
|
</BODY>
|
305 |
|
|
</HTML>
|