1<TITLE>spinner - Create and manipulate a spinner widget</TITLE> 2<H1>spinner - Create and manipulate a spinner widget</H1> 3 4</pre><H2>SYNOPSIS</H2> 5<B>spinner<I> <I>pathName </I>?<I>options</I>? 6</pre><H2>INHERITANCE</H2> 7itk::Widget <- Labeledwidget <- Spinner 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</td> 31<td valign=top> 32<B>exportSelection</B><br> 33<B>insertBackground</B><br> 34<B>insertWidth</B><br> 35<B>selectBorderWidth</B><br> 36</td> 37</table> 38<P> 39See 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. 40</pre><H2>ASSOCIATED OPTIONS</H2> 41<P> 42<table cellpadding=5> 43<td valign=top> 44<B>show</B><br> 45</td> 46<td valign=top> 47<B>state</B><br> 48</td> 49<td valign=top> 50</td> 51<td valign=top> 52</td> 53</table> 54<P> 55See 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. 56</pre><H2>INHERITED OPTIONS</H2> 57<P> 58<table cellpadding=5> 59<td valign=top> 60<B>childSitePos</B><br> 61<B>invalid</B><br> 62<B>width</B><br> 63</td> 64<td valign=top> 65<B>command</B><br> 66<B>textBackground</B><br> 67</td> 68<td valign=top> 69<B>fixed</B><br> 70<B>textFont</B><br> 71</td> 72<td valign=top> 73<B>focusCommand</B><br> 74<B>validate</B><br> 75</td> 76</table> 77<P> 78See the <A HREF="entryfield.n.html"> "entryfield" </A> widget manual entry for details on the above 79inherited options. 80<P> 81<table cellpadding=5> 82<td valign=top> 83<B>disabledForeground</B><br> 84<B>labelMargin</B><br> 85<B>state</B><br> 86</td> 87<td valign=top> 88<B>labelBitmap</B><br> 89<B>labelPos</B><br> 90</td> 91<td valign=top> 92<B>labelFont</B><br> 93<B>labelText</B><br> 94</td> 95<td valign=top> 96<B>labelImage</B><br> 97<B>labelVariable</B><br> 98</td> 99</table> 100<P> 101See the <A HREF="labeledwidget.n.html"> "labeledwidget" </A> widget manual entry for details on the above 102inherited options. 103</pre><H2>WIDGET-SPECIFIC OPTIONS</H2> 104<P> 105<pre> 106Name: <B>arrowOrient</B> 107Class: <B>Orient</B> 108Command-Line Switch: <B>-arroworient</B> 109</pre> 110<UL> 111Specifies placement of arrow buttons: <B>horizontal</B> or <B>vertical</B>. 112The default is vertical. 113</UL> 114<P> 115<pre> 116Name: <B>decrement</B> 117Class: <B>Command</B> 118Command-Line Switch: <B>-decrement</B> 119</pre> 120<UL> 121Tcl command to be executed when down arrow is pressed. 122</UL> 123<P> 124<pre> 125Name: <B>increment</B> 126Class: <B>Command</B> 127Command-Line Switch: <B>-increment</B> 128</pre> 129<UL> 130Tcl command to be executed when up arrow is pressed. 131</UL> 132<P> 133<pre> 134Name: <B>repeatDelay</B> 135Class: <B>RepeatDelay</B> 136Command-Line Switch: <B>-repeatdelay</B> 137</pre> 138<UL> 139Specifies the initial delay in milliseconds before the spinner repeat action 140on the arrow buttons engages. The default is 300 milliseconds. 141</UL> 142<P> 143<pre> 144Name: <B>repeatInterval</B> 145Class: <B>RepeatInterval</B> 146Command-Line Switch: <B>-repeatinterval</B> 147</pre> 148<UL> 149Specifies the repeat delay in milliseconds between selections of the arrow 150buttons. A repeatinterval of 0 disables button repeat. The default is 151100 milliseconds. 152</UL> 153<P> 154</pre><HR> 155 156</pre><H2>DESCRIPTION</H2> 157<P> 158The <B>spinner</B> command creates a spinner widget. The spinner is 159comprised of an entryfield plus up and down arrow buttons. 160Arrows may be drawn horizontally or vertically. 161</pre> 162 163</pre><H2>METHODS</H2> 164<P> 165The <B>spinner</B> command creates a new Tcl command whose 166name is <I>pathName</I>. This 167command may be used to invoke various 168operations on the widget. It has the following general form: 169<pre> 170<I>pathName option </I>?<I>arg arg ...</I>? 171</pre> 172<I>Option</I> and the <I>arg</I>s 173determine the exact behavior of the command. The following 174commands are possible for spinner widgets: 175</pre><H2>ASSOCIATED METHODS</H2> 176<P> 177<table cellpadding=5> 178<td valign=top> 179<B>delete</B><br> 180<B>insert</B><br> 181</td> 182<td valign=top> 183<B>get</B><br> 184<B>scan</B><br> 185</td> 186<td valign=top> 187<B>icursor</B><br> 188<B>selection</B><br> 189</td> 190<td valign=top> 191<B>index</B><br> 192<B>xview</B><br> 193</td> 194</table> 195<P> 196See 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. 197</pre><H2>INHERITED METHODS</H2> 198<P> 199<table cellpadding=5> 200<td valign=top> 201<B>childsite</B><br> 202</td> 203<td valign=top> 204<B>clear</B><br> 205</td> 206<td valign=top> 207<B>peek</B><br> 208</td> 209<td valign=top> 210</td> 211</table> 212<P> 213See the <A HREF="entryfield.n.html"> "entryfield" </A> manual entry for details on the associated methods. 214</pre><H2>WIDGET-SPECIFIC METHODS</H2> 215<DL> 216<DT> <I>pathName <B>cget</B> <I>option</I> 217</I></B> 218<DD> Returns the current value of the configuration option given 219by <I>option</I>. 220<I>Option</I> may have any of the values accepted by the <B>spinner</B> 221command. 222</DL> 223<DL> 224<DT> <I>pathName</I> <B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>? 225</I></B> 226<DD> Query or modify the configuration options of the widget. 227If no <I>option</I> is specified, returns a list describing all of 228the available options for <I>pathName</I> (see <B>Tk_ConfigureInfo</B> for 229information on the format of this list). If <I>option</I> is specified 230with no <I>value</I>, then the command returns a list describing the 231one named option (this list will be identical to the corresponding 232sublist of the value returned if no <I>option</I> is specified). If 233one or more <I>option-value</I> pairs are specified, then the command 234modifies the given widget option(s) to have the given value(s); in 235this case the command returns an empty string. 236<I>Option</I> may have any of the values accepted by the <B>spinner</B> 237command. 238</DL> 239<DL> 240<DT> <I>pathName <B>down</B> 241</I></B> 242<DD> Derived classes may overload this method to specialize functionality. 243</DL> 244<DL> 245<DT> <I>pathName <B>up</B> 246</I></B> 247<DD> Derived classes may overload this method to specialize functionality. 248 249</DL> 250</pre><H2>COMPONENTS</H2> 251<P> 252<pre> 253Name: <B>downarrow</B> 254Class: <B>Canvas</B> 255</pre> 256<UL> 257The downarrow component is the downward pointing button of the spinner. See 258the "canvas" widget manual entry for details on the downarrow component item. 259</UL> 260<P> 261<pre> 262Name: <B>uparrow</B> 263Class: <B>Canvas</B> 264</pre> 265<UL> 266The uparrow component is the upward pointing button of the spinner. See 267the "canvas" widget manual entry for details on the uparrow component item. 268</UL> 269</table> 270 271</pre><H2>EXAMPLE</H2> 272<pre> 273 set months {January February March April May June July \\ 274 August September October November December} 275 276 proc blockInput {char} { 277 return 0 278 } 279 280 proc spinMonth {step} { 281 global months 282 283 set index [expr [lsearch $months [.sm get]] + $step] 284 285 if {$index < 0} {set index 11} 286 if {$index > 11} {set index 0} 287 288 .sm delete 0 end 289 .sm insert 0 [lindex $months $index] 290 } 291 292 spinner .sm -labeltext "Month : " -width 10 -fixed 10 -validate blockInput \\ 293 -decrement {spinMonth -1} -increment {spinMonth 1} 294 .sm insert 0 January 295 296 pack .sm -padx 10 -pady 10 297</pre> 298</pre><H2>ACKNOWLEDGEMENTS:</H2> 299<P> 300Ken Copeland <ken@hilco.com> 301<UL> 30210/18/95 - Added auto-repeat action to spinner arrow buttons. 303</UL> 304<P> 305</pre><H2>AUTHOR</H2> 306Sue Yockey 307</pre><H2>KEYWORDS</H2> 308spinner, widget 309