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