Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / man / mann / spinbox.n
CommitLineData
920dae64
AT
1'\"
2'\" Copyright (c) 2000 Jeffrey Hobbs.
3'\" Copyright (c) 2000 Ajuba Solutions.
4'\"
5'\" See the file "license.terms" for information on usage and redistribution
6'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7'\"
8'\" RCS: @(#) $Id: spinbox.n,v 1.3.2.1 2004/10/28 12:25:22 dkf Exp $
9'\"
10'\" The definitions below are for supplemental macros used in Tcl/Tk
11'\" manual entries.
12'\"
13'\" .AP type name in/out ?indent?
14'\" Start paragraph describing an argument to a library procedure.
15'\" type is type of argument (int, etc.), in/out is either "in", "out",
16'\" or "in/out" to describe whether procedure reads or modifies arg,
17'\" and indent is equivalent to second arg of .IP (shouldn't ever be
18'\" needed; use .AS below instead)
19'\"
20'\" .AS ?type? ?name?
21'\" Give maximum sizes of arguments for setting tab stops. Type and
22'\" name are examples of largest possible arguments that will be passed
23'\" to .AP later. If args are omitted, default tab stops are used.
24'\"
25'\" .BS
26'\" Start box enclosure. From here until next .BE, everything will be
27'\" enclosed in one large box.
28'\"
29'\" .BE
30'\" End of box enclosure.
31'\"
32'\" .CS
33'\" Begin code excerpt.
34'\"
35'\" .CE
36'\" End code excerpt.
37'\"
38'\" .VS ?version? ?br?
39'\" Begin vertical sidebar, for use in marking newly-changed parts
40'\" of man pages. The first argument is ignored and used for recording
41'\" the version when the .VS was added, so that the sidebars can be
42'\" found and removed when they reach a certain age. If another argument
43'\" is present, then a line break is forced before starting the sidebar.
44'\"
45'\" .VE
46'\" End of vertical sidebar.
47'\"
48'\" .DS
49'\" Begin an indented unfilled display.
50'\"
51'\" .DE
52'\" End of indented unfilled display.
53'\"
54'\" .SO
55'\" Start of list of standard options for a Tk widget. The
56'\" options follow on successive lines, in four columns separated
57'\" by tabs.
58'\"
59'\" .SE
60'\" End of list of standard options for a Tk widget.
61'\"
62'\" .OP cmdName dbName dbClass
63'\" Start of description of a specific option. cmdName gives the
64'\" option's name as specified in the class command, dbName gives
65'\" the option's name in the option database, and dbClass gives
66'\" the option's class in the option database.
67'\"
68'\" .UL arg1 arg2
69'\" Print arg1 underlined, then print arg2 normally.
70'\"
71'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
72'\"
73'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
74.if t .wh -1.3i ^B
75.nr ^l \n(.l
76.ad b
77'\" # Start an argument description
78.de AP
79.ie !"\\$4"" .TP \\$4
80.el \{\
81. ie !"\\$2"" .TP \\n()Cu
82. el .TP 15
83.\}
84.ta \\n()Au \\n()Bu
85.ie !"\\$3"" \{\
86\&\\$1 \\fI\\$2\\fP (\\$3)
87.\".b
88.\}
89.el \{\
90.br
91.ie !"\\$2"" \{\
92\&\\$1 \\fI\\$2\\fP
93.\}
94.el \{\
95\&\\fI\\$1\\fP
96.\}
97.\}
98..
99'\" # define tabbing values for .AP
100.de AS
101.nr )A 10n
102.if !"\\$1"" .nr )A \\w'\\$1'u+3n
103.nr )B \\n()Au+15n
104.\"
105.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
106.nr )C \\n()Bu+\\w'(in/out)'u+2n
107..
108.AS Tcl_Interp Tcl_CreateInterp in/out
109'\" # BS - start boxed text
110'\" # ^y = starting y location
111'\" # ^b = 1
112.de BS
113.br
114.mk ^y
115.nr ^b 1u
116.if n .nf
117.if n .ti 0
118.if n \l'\\n(.lu\(ul'
119.if n .fi
120..
121'\" # BE - end boxed text (draw box now)
122.de BE
123.nf
124.ti 0
125.mk ^t
126.ie n \l'\\n(^lu\(ul'
127.el \{\
128.\" Draw four-sided box normally, but don't draw top of
129.\" box if the box started on an earlier page.
130.ie !\\n(^b-1 \{\
131\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
132.\}
133.el \}\
134\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
135.\}
136.\}
137.fi
138.br
139.nr ^b 0
140..
141'\" # VS - start vertical sidebar
142'\" # ^Y = starting y location
143'\" # ^v = 1 (for troff; for nroff this doesn't matter)
144.de VS
145.if !"\\$2"" .br
146.mk ^Y
147.ie n 'mc \s12\(br\s0
148.el .nr ^v 1u
149..
150'\" # VE - end of vertical sidebar
151.de VE
152.ie n 'mc
153.el \{\
154.ev 2
155.nf
156.ti 0
157.mk ^t
158\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
159.sp -1
160.fi
161.ev
162.\}
163.nr ^v 0
164..
165'\" # Special macro to handle page bottom: finish off current
166'\" # box/sidebar if in box/sidebar mode, then invoked standard
167'\" # page bottom macro.
168.de ^B
169.ev 2
170'ti 0
171'nf
172.mk ^t
173.if \\n(^b \{\
174.\" Draw three-sided box if this is the box's first page,
175.\" draw two sides but no top otherwise.
176.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
177.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
178.\}
179.if \\n(^v \{\
180.nr ^x \\n(^tu+1v-\\n(^Yu
181\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
182.\}
183.bp
184'fi
185.ev
186.if \\n(^b \{\
187.mk ^y
188.nr ^b 2
189.\}
190.if \\n(^v \{\
191.mk ^Y
192.\}
193..
194'\" # DS - begin display
195.de DS
196.RS
197.nf
198.sp
199..
200'\" # DE - end display
201.de DE
202.fi
203.RE
204.sp
205..
206'\" # SO - start of list of standard options
207.de SO
208.SH "STANDARD OPTIONS"
209.LP
210.nf
211.ta 5.5c 11c
212.ft B
213..
214'\" # SE - end of list of standard options
215.de SE
216.fi
217.ft R
218.LP
219See the \\fBoptions\\fR manual entry for details on the standard options.
220..
221'\" # OP - start of full description for a single option
222.de OP
223.LP
224.nf
225.ta 4c
226Command-Line Name: \\fB\\$1\\fR
227Database Name: \\fB\\$2\\fR
228Database Class: \\fB\\$3\\fR
229.fi
230.IP
231..
232'\" # CS - begin code excerpt
233.de CS
234.RS
235.nf
236.ta .25i .5i .75i 1i
237..
238'\" # CE - end code excerpt
239.de CE
240.fi
241.RE
242..
243.de UL
244\\$1\l'|0\(ul'\\$2
245..
246.TH spinbox n 8.4 Tk "Tk Built-In Commands"
247.BS
248'\" Note: do not modify the .SH NAME line immediately below!
249.SH NAME
250spinbox \- Create and manipulate spinbox widgets
251.SH SYNOPSIS
252\fBspinbox\fR \fIpathName \fR?\fIoptions\fR?
253.SO
254\-activebackground \-highlightthickness \-repeatinterval
255\-background \-insertbackground \-selectbackground
256\-borderwidth \-insertborderwidth \-selectborderwidth
257\-cursor \-insertontime \-selectforeground
258\-exportselection \-insertwidth \-takefocus
259\-font \-insertofftime \-textvariable
260\-foreground \-justify \-xscrollcommand
261\-highlightbackground \-relief
262\-highlightcolor \-repeatdelay
263.SE
264.SH "WIDGET-SPECIFIC OPTIONS"
265.OP \-buttonbackground buttonBackground Background
266The background color to be used for the spin buttons.
267.OP \-buttoncursor buttonCursor Cursor
268The cursor to be used when over the spin buttons. If this is empty
269(the default), a default cursor will be used.
270.OP \-buttondownrelief buttonDownRelief Relief
271The relief to be used for the upper spin button.
272.OP \-buttonuprelief buttonUpRelief Relief
273The relief to be used for the lower spin button.
274.OP \-command command Command
275Specifies a Tcl command to invoke whenever a spinbutton is invoked.
276The command recognizes several percent substitutions: \fB%W\fR for
277the widget path, \fB%s\fR for the current value of the widget, and
278\fB%d\fR for the direction of the button pressed (\fBup\fR or \fBdown\fR).
279.OP \-disabledbackground disabledBackground DisabledBackground
280Specifies the background color to use when the spinbox is disabled. If
281this option is the empty string, the normal background color is used.
282.OP \-disabledforeground disabledForeground DisabledForeground
283Specifies the foreground color to use when the spinbox is disabled. If
284this option is the empty string, the normal foreground color is used.
285.OP \-format format Format
286Specifies an alternate format to use when setting the string value
287when using the \fB\-from\fR and \fB\-to\fR range.
288This must be a format specifier of the form \fB%<pad>.<pad>f\fR,
289as it will format a floating-point number.
290.OP \-from from From
291A floating-point value corresponding to the lowest value for a spinbox, to
292be used in conjunction with \fB\-to\fR and \fB\-increment\fR. When all
293are specified correctly, the spinbox will use these values to control its
294contents. This value must be less than the \fB\-to\fR option.
295If \fB\-values\fR is specified, it supercedes this option.
296.OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand
297Specifies a script to eval when \fBvalidateCommand\fR returns 0. Setting
298it to an empty string disables this feature (the default). The best use of
299this option is to set it to \fIbell\fR. See \fBValidation\fR below for
300more information.
301.OP \-increment increment Increment
302A floating-point value specifying the increment. When used with
303\fB\-from\fR and \fB\-to\fR, the value in the widget will be adjusted by
304\fB\-increment\fR when a spin button is pressed (up adds the value,
305down subtracts the value).
306.OP \-readonlybackground readonlyBackground ReadonlyBackground
307Specifies the background color to use when the spinbox is readonly. If
308this option is the empty string, the normal background color is used.
309.OP \-state state State
310Specifies one of three states for the spinbox: \fBnormal\fR,
311\fBdisabled\fR, or \fBreadonly\fR. If the spinbox is readonly, then the
312value may not be changed using widget commands and no insertion cursor
313will be displayed, even if the input focus is in the widget; the
314contents of the widget may still be selected. If the spinbox is
315disabled, the value may not be changed, no insertion cursor will be
316displayed, the contents will not be selectable, and the spinbox may
317be displayed in a different color, depending on the values of the
318\fB-disabledforeground\fR and \fB-disabledbackground\fR options.
319.OP \-to to To
320A floating-point value corresponding to the highest value for the spinbox,
321to be used in conjunction with \fB\-from\fR and \fB\-increment\fR. When
322all are specified correctly, the spinbox will use these values to control
323its contents. This value must be greater than the \fB\-from\fR option.
324If \fB\-values\fR is specified, it supercedes this option.
325.OP \-validate validate Validate
326Specifies the mode in which validation should operate: \fBnone\fR,
327\fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR.
328It defaults to \fBnone\fR. When you want validation, you must explicitly
329state which mode you wish to use. See \fBValidation\fR below for more.
330.OP "\-validatecommand or \-vcmd" validateCommand ValidateCommand
331Specifies a script to evaluate when you want to validate the input in the
332widget. Setting it to an empty string disables this feature (the default).
333Validation occurs according to the value of \fB\-validate\fR.
334This command must return a valid Tcl boolean value. If it returns 0 (or
335the valid Tcl boolean equivalent) then the value of the widget will not
336change and the \fBinvalidCommand\fR will be evaluated if it is set. If it
337returns 1, then value will be changed.
338See \fBValidation\fR below for more information.
339.OP \-values values Values
340Must be a proper list value. If specified, the spinbox will use these
341values as to control its contents, starting with the first value. This
342option has precedence over the \fB\-from\fR and \fB\-to\fR range.
343.OP \-width width Width
344Specifies an integer value indicating the desired width of the spinbox window,
345in average-size characters of the widget's font.
346If the value is less than or equal to zero, the widget picks a
347size just large enough to hold its current text.
348.OP \-wrap wrap wrap
349Must be a proper boolean value. If on, the spinbox will wrap around the
350values of data in the widget.
351.BE
352
353.SH DESCRIPTION
354.PP
355The \fBspinbox\fR command creates a new window (given by the
356\fIpathName\fR argument) and makes it into a spinbox widget.
357Additional options, described above, may be specified on the
358command line or in the option database
359to configure aspects of the spinbox such as its colors, font,
360and relief. The \fBspinbox\fR command returns its
361\fIpathName\fR argument. At the time this command is invoked,
362there must not exist a window named \fIpathName\fR, but
363\fIpathName\fR's parent must exist.
364.PP
365A \fBspinbox\fR is an extended \fBentry\fR widget that allows he user
366to move, or spin, through a fixed set of ascending or descending values
367such as times or dates in addition to editing the value as in an
368\fBentry\fR. When first created, a spinbox's string is empty.
369A portion of the spinbox may be selected as described below.
370If a spinbox is exporting its selection (see the \fBexportSelection\fR
371option), then it will observe the standard protocols for handling the
372selection; spinbox selections are available as type \fBSTRING\fR.
373Spinboxes also observe the standard Tk rules for dealing with the
374input focus. When a spinbox has the input focus it displays an
375\fIinsertion cursor\fR to indicate where new characters will be
376inserted.
377.PP
378Spinboxes are capable of displaying strings that are too long to
379fit entirely within the widget's window. In this case, only a
380portion of the string will be displayed; commands described below
381may be used to change the view in the window. Spinboxes use
382the standard \fBxScrollCommand\fR mechanism for interacting with
383scrollbars (see the description of the \fBxScrollCommand\fR option
384for details). They also support scanning, as described below.
385
386.SH VALIDATION
387.PP
388Validation works by setting the \fBvalidateCommand\fR
389option to a script which will be evaluated according to the \fBvalidate\fR
390option as follows:
391.PP
392.IP \fBnone\fR 10
393Default. This means no validation will occur.
394.IP \fBfocus\fR 10
395\fBvalidateCommand\fR will be called when the spinbox receives or
396loses focus.
397.IP \fBfocusin\fR 10
398\fBvalidateCommand\fR will be called when the spinbox receives focus.
399.IP \fBfocusout\fR 10
400\fBvalidateCommand\fR will be called when the spinbox loses focus.
401.IP \fBkey\fR 10
402\fBvalidateCommand\fR will be called when the spinbox is edited.
403.IP \fBall\fR 10
404\fBvalidateCommand\fR will be called for all above conditions.
405.PP
406It is possible to perform percent substitutions on the \fBvalidateCommand\fR
407and \fBinvalidCommand\fR, just as you would in a \fBbind\fR script. The
408following substitutions are recognized:
409.PP
410.IP \fB%d\fR 5
411Type of action: 1 for \fBinsert\fR, 0 for \fBdelete\fR,
412or -1 for focus, forced or textvariable validation.
413.IP \fB%i\fR 5
414Index of char string to be inserted/deleted, if any, otherwise -1.
415.IP \fB%P\fR 5
416The value of the spinbox should edition occur. If you are configuring the
417spinbox widget to have a new textvariable, this will be the value of that
418textvariable.
419.IP \fB%s\fR 5
420The current value of spinbox before edition.
421.IP \fB%S\fR 5
422The text string being inserted/deleted, if any.
423Otherwise it is an empty string.
424.IP \fB%v\fR 5
425The type of validation currently set.
426.IP \fB%V\fR 5
427The type of validation that triggered the callback
428(key, focusin, focusout, forced).
429.IP \fB%W\fR 5
430The name of the spinbox widget.
431.PP
432In general, the \fBtextVariable\fR and \fBvalidateCommand\fR can be
433dangerous to mix. Any problems have been overcome so that using the
434\fBvalidateCommand\fR will not interfere with the traditional behavior of
435the spinbox widget. Using the \fBtextVariable\fR for read-only purposes will
436never cause problems. The danger comes when you try set the
437\fBtextVariable\fR to something that the \fBvalidateCommand\fR would not
438accept, which causes \fBvalidate\fR to become \fInone\fR (the
439\fBinvalidCommand\fR will not be triggered). The same happens
440when an error occurs evaluating the \fBvalidateCommand\fR.
441.PP
442Primarily, an error will occur when the \fBvalidateCommand\fR or
443\fBinvalidCommand\fR encounters an error in its script while evaluating or
444\fBvalidateCommand\fR does not return a valid Tcl boolean value. The
445\fBvalidate\fR option will also set itself to \fBnone\fR when you edit the
446spinbox widget from within either the \fBvalidateCommand\fR or the
447\fBinvalidCommand\fR. Such editions will override the one that was being
448validated. If you wish to edit the value of the widget
449during validation and still have the \fBvalidate\fR option set, you should
450include the command
451.CS
452 \fI%W config -validate %v\fR
453.CE
454in the \fBvalidateCommand\fR or \fBinvalidCommand\fR (whichever one you
455were editing the spinbox widget from). It is also recommended to not set an
456associated \fBtextVariable\fR during validation, as that can cause the
457spinbox widget to become out of sync with the \fBtextVariable\fR.
458
459.SH "WIDGET COMMAND"
460.PP
461The \fBspinbox\fR command creates a new Tcl command whose
462name is \fIpathName\fR. This command may be used to invoke various
463operations on the widget. It has the following general form:
464.CS
465\fIpathName option \fR?\fIarg arg ...\fR?
466.CE
467\fIOption\fR and the \fIarg\fRs
468determine the exact behavior of the command.
469.PP
470Many of the widget commands for spinboxes take one or more indices as
471arguments. An index specifies a particular character in the spinbox's
472string, in any of the following ways:
473.TP 12
474\fInumber\fR
475Specifies the character as a numerical index, where 0 corresponds
476to the first character in the string.
477.TP 12
478\fBanchor\fR
479Indicates the anchor point for the selection, which is set with the
480\fBselect from\fR and \fBselect adjust\fR widget commands.
481.TP 12
482\fBend\fR
483Indicates the character just after the last one in the spinbox's string.
484This is equivalent to specifying a numerical index equal to the length
485of the spinbox's string.
486.TP 12
487\fBinsert\fR
488Indicates the character adjacent to and immediately following the
489insertion cursor.
490.TP 12
491\fBsel.first\fR
492Indicates the first character in the selection. It is an error to
493use this form if the selection isn't in the spinbox window.
494.TP 12
495\fBsel.last\fR
496Indicates the character just after the last one in the selection.
497It is an error to use this form if the selection isn't in the
498spinbox window.
499.TP 12
500\fB@\fInumber\fR
501In this form, \fInumber\fR is treated as an x-coordinate in the
502spinbox's window; the character spanning that x-coordinate is used.
503For example, ``\fB@0\fR'' indicates the left-most character in the
504window.
505.LP
506Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
507or ``\fBsel.f\fR''. In general, out-of-range indices are automatically
508rounded to the nearest legal value.
509.PP
510The following commands are possible for spinbox widgets:
511.TP
512\fIpathName \fBbbox \fIindex\fR
513Returns a list of four numbers describing the bounding box of the
514character given by \fIindex\fR.
515The first two elements of the list give the x and y coordinates of
516the upper-left corner of the screen area covered by the character
517(in pixels relative to the widget) and the last two elements give
518the width and height of the character, in pixels.
519The bounding box may refer to a region outside the visible area
520of the window.
521.TP
522\fIpathName \fBcget\fR \fIoption\fR
523Returns the current value of the configuration option given
524by \fIoption\fR.
525\fIOption\fR may have any of the values accepted by the \fBspinbox\fR
526command.
527.TP
528\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
529Query or modify the configuration options of the widget.
530If no \fIoption\fR is specified, returns a list describing all of
531the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
532information on the format of this list). If \fIoption\fR is specified
533with no \fIvalue\fR, then the command returns a list describing the
534one named option (this list will be identical to the corresponding
535sublist of the value returned if no \fIoption\fR is specified). If
536one or more \fIoption\-value\fR pairs are specified, then the command
537modifies the given widget option(s) to have the given value(s); in
538this case the command returns an empty string.
539\fIOption\fR may have any of the values accepted by the \fBspinbox\fR
540command.
541.TP
542\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
543Delete one or more elements of the spinbox.
544\fIFirst\fR is the index of the first character to delete, and
545\fIlast\fR is the index of the character just after the last
546one to delete.
547If \fIlast\fR isn't specified it defaults to \fIfirst\fR+1,
548i.e. a single character is deleted.
549This command returns an empty string.
550.TP
551\fIpathName \fBget\fR
552Returns the spinbox's string.
553.TP
554\fIpathName \fBicursor \fIindex\fR
555Arrange for the insertion cursor to be displayed just before the character
556given by \fIindex\fR. Returns an empty string.
557.TP
558\fIpathName \fBidentify\fI x y\fR
559Returns the name of the window element corresponding to coordinates
560\fIx\fR and \fIy\fR in the spinbox. Return value is one of:
561\fBnone\fR, \fBbuttondown\fR, \fBbuttonup\fR, \fBentry\fR.
562.TP
563\fIpathName \fBindex\fI index\fR
564Returns the numerical index corresponding to \fIindex\fR.
565.TP
566\fIpathName \fBinsert \fIindex string\fR
567Insert the characters of \fIstring\fR just before the character
568indicated by \fIindex\fR. Returns an empty string.
569.TP
570\fIpathName \fBinvoke\fI element\fR
571Causes the specified element, either \fBbuttondown\fR or \fBbuttonup\fR,
572to be invoked, triggering the action associated with it.
573.TP
574\fIpathName \fBscan\fR \fIoption args\fR
575This command is used to implement scanning on spinboxes. It has
576two forms, depending on \fIoption\fR:
577.RS
578.TP
579\fIpathName \fBscan mark \fIx\fR
580Records \fIx\fR and the current view in the spinbox window; used in
581conjunction with later \fBscan dragto\fR commands. Typically this
582command is associated with a mouse button press in the widget. It
583returns an empty string.
584.TP
585\fIpathName \fBscan dragto \fIx\fR
586This command computes the difference between its \fIx\fR argument
587and the \fIx\fR argument to the last \fBscan mark\fR command for
588the widget. It then adjusts the view left or right by 10 times the
589difference in x-coordinates. This command is typically associated
590with mouse motion events in the widget, to produce the effect of
591dragging the spinbox at high speed through the window. The return
592value is an empty string.
593.RE
594.TP
595\fIpathName \fBselection \fIoption arg\fR
596This command is used to adjust the selection within a spinbox. It
597has several forms, depending on \fIoption\fR:
598.RS
599.TP
600\fIpathName \fBselection adjust \fIindex\fR
601Locate the end of the selection nearest to the character given by
602\fIindex\fR, and adjust that end of the selection to be at \fIindex\fR
603(i.e. including but not going beyond \fIindex\fR). The other
604end of the selection is made the anchor point for future
605\fBselect to\fR commands. If the selection
606isn't currently in the spinbox, then a new selection is created to
607include the characters between \fIindex\fR and the most recent
608selection anchor point, inclusive.
609Returns an empty string.
610.TP
611\fIpathName \fBselection clear\fR
612Clear the selection if it is currently in this widget. If the
613selection isn't in this widget then the command has no effect.
614Returns an empty string.
615.TP
616\fIpathName \fBselection element\fR ?\fIelement\fR?
617Sets or gets the currently selected element. If a spinbutton element
618is specified, it will be displayed depressed.
619.TP
620\fIpathName \fBselection from \fIindex\fR
621Set the selection anchor point to just before the character
622given by \fIindex\fR. Doesn't change the selection.
623Returns an empty string.
624.TP
625\fIpathName \fBselection present\fR
626Returns 1 if there is are characters selected in the spinbox,
6270 if nothing is selected.
628.TP
629\fIpathName \fBselection range \fIstart\fR \fIend\fR
630Sets the selection to include the characters starting with
631the one indexed by \fIstart\fR and ending with the one just
632before \fIend\fR.
633If \fIend\fR refers to the same character as \fIstart\fR or an
634earlier one, then the spinbox's selection is cleared.
635.TP
636\fIpathName \fBselection to \fIindex\fR
637If \fIindex\fR is before the anchor point, set the selection
638to the characters from \fIindex\fR up to but not including
639the anchor point.
640If \fIindex\fR is the same as the anchor point, do nothing.
641If \fIindex\fR is after the anchor point, set the selection
642to the characters from the anchor point up to but not including
643\fIindex\fR.
644The anchor point is determined by the most recent \fBselect from\fR
645or \fBselect adjust\fR command in this widget.
646If the selection isn't in this widget then a new selection is
647created using the most recent anchor point specified for the widget.
648Returns an empty string.
649.RE
650.TP
651\fIpathName \fBset\fR ?\fIstring\fR?
652If \fIstring\fR is specified, the spinbox will try and set it to this
653value, otherwise it just returns the spinbox's string.
654If validation is on, it will occur when setting the string.
655.TP
656\fIpathName \fBvalidate\fR
657This command is used to force an evaluation of the \fBvalidateCommand\fR
658independent of the conditions specified by the \fBvalidate\fR option.
659This is done by temporarily setting the \fBvalidate\fR option to \fBall\fR.
660It returns 0 or 1.
661.TP
662\fIpathName \fBxview \fIargs\fR
663This command is used to query and change the horizontal position of the
664text in the widget's window. It can take any of the following
665forms:
666.RS
667.TP
668\fIpathName \fBxview\fR
669Returns a list containing two elements.
670Each element is a real fraction between 0 and 1; together they describe
671the horizontal span that is visible in the window.
672For example, if the first element is .2 and the second element is .6,
67320% of the spinbox's text is off-screen to the left, the middle 40% is visible
674in the window, and 40% of the text is off-screen to the right.
675These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
676option.
677.TP
678\fIpathName \fBxview\fR \fIindex\fR
679Adjusts the view in the window so that the character given by \fIindex\fR
680is displayed at the left edge of the window.
681.TP
682\fIpathName \fBxview moveto\fI fraction\fR
683Adjusts the view in the window so that the character \fIfraction\fR of the
684way through the text appears at the left edge of the window.
685\fIFraction\fR must be a fraction between 0 and 1.
686.TP
687\fIpathName \fBxview scroll \fInumber what\fR
688This command shifts the view in the window left or right according to
689\fInumber\fR and \fIwhat\fR.
690\fINumber\fR must be an integer.
691\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
692of one of these.
693If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
694\fInumber\fR average-width characters on the display; if it is
695\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
696If \fInumber\fR is negative then characters farther to the left
697become visible; if it is positive then characters farther to the right
698become visible.
699.RE
700
701.SH "DEFAULT BINDINGS"
702.PP
703Tk automatically creates class bindings for spinboxes that give them
704the following default behavior.
705In the descriptions below, ``word'' refers to a contiguous group
706of letters, digits, or ``_'' characters, or any single character
707other than these.
708.IP [1]
709Clicking mouse button 1 positions the insertion cursor
710just before the character underneath the mouse cursor, sets the
711input focus to this widget, and clears any selection in the widget.
712Dragging with mouse button 1 strokes out a selection between
713the insertion cursor and the character under the mouse.
714.IP [2]
715Double-clicking with mouse button 1 selects the word under the mouse
716and positions the insertion cursor at the beginning of the word.
717Dragging after a double click will stroke out a selection consisting
718of whole words.
719.IP [3]
720Triple-clicking with mouse button 1 selects all of the text in the
721spinbox and positions the insertion cursor before the first character.
722.IP [4]
723The ends of the selection can be adjusted by dragging with mouse
724button 1 while the Shift key is down; this will adjust the end
725of the selection that was nearest to the mouse cursor when button
7261 was pressed.
727If the button is double-clicked before dragging then the selection
728will be adjusted in units of whole words.
729.IP [5]
730Clicking mouse button 1 with the Control key down will position the
731insertion cursor in the spinbox without affecting the selection.
732.IP [6]
733If any normal printing characters are typed in a spinbox, they are
734inserted at the point of the insertion cursor.
735.IP [7]
736The view in the spinbox can be adjusted by dragging with mouse button 2.
737If mouse button 2 is clicked without moving the mouse, the selection
738is copied into the spinbox at the position of the mouse cursor.
739.IP [8]
740If the mouse is dragged out of the spinbox on the left or right sides
741while button 1 is pressed, the spinbox will automatically scroll to
742make more text visible (if there is more text off-screen on the side
743where the mouse left the window).
744.IP [9]
745The Left and Right keys move the insertion cursor one character to the
746left or right; they also clear any selection in the spinbox and set
747the selection anchor.
748If Left or Right is typed with the Shift key down, then the insertion
749cursor moves and the selection is extended to include the new character.
750Control-Left and Control-Right move the insertion cursor by words, and
751Control-Shift-Left and Control-Shift-Right move the insertion cursor
752by words and also extend the selection.
753Control-b and Control-f behave the same as Left and Right, respectively.
754Meta-b and Meta-f behave the same as Control-Left and Control-Right,
755respectively.
756.IP [10]
757The Home key, or Control-a, will move the insertion cursor to the
758beginning of the spinbox and clear any selection in the spinbox.
759Shift-Home moves the insertion cursor to the beginning of the spinbox
760and also extends the selection to that point.
761.IP [11]
762The End key, or Control-e, will move the insertion cursor to the
763end of the spinbox and clear any selection in the spinbox.
764Shift-End moves the cursor to the end and extends the selection
765to that point.
766.IP [12]
767The Select key and Control-Space set the selection anchor to the position
768of the insertion cursor. They don't affect the current selection.
769Shift-Select and Control-Shift-Space adjust the selection to the
770current position of the insertion cursor, selecting from the anchor
771to the insertion cursor if there was not any selection previously.
772.IP [13]
773Control-/ selects all the text in the spinbox.
774.IP [14]
775Control-\e clears any selection in the spinbox.
776.IP [15]
777The F16 key (labelled Copy on many Sun workstations) or Meta-w
778copies the selection in the widget to the clipboard, if there is a selection.
779.IP [16]
780The F20 key (labelled Cut on many Sun workstations) or Control-w
781copies the selection in the widget to the clipboard and deletes
782the selection.
783If there is no selection in the widget then these keys have no effect.
784.IP [17]
785The F18 key (labelled Paste on many Sun workstations) or Control-y
786inserts the contents of the clipboard at the position of the
787insertion cursor.
788.IP [18]
789The Delete key deletes the selection, if there is one in the spinbox.
790If there is no selection, it deletes the character to the right of
791the insertion cursor.
792.IP [19]
793The BackSpace key and Control-h delete the selection, if there is one
794in the spinbox.
795If there is no selection, it deletes the character to the left of
796the insertion cursor.
797.IP [20]
798Control-d deletes the character to the right of the insertion cursor.
799.IP [21]
800Meta-d deletes the word to the right of the insertion cursor.
801.IP [22]
802Control-k deletes all the characters to the right of the insertion
803cursor.
804.IP [23]
805Control-t reverses the order of the two characters to the right of
806the insertion cursor.
807.PP
808If the spinbox is disabled using the \fB\-state\fR option, then the spinbox's
809view can still be adjusted and text in the spinbox can still be selected,
810but no insertion cursor will be displayed and no text modifications will
811take place.
812.PP
813The behavior of spinboxes can be changed by defining new bindings for
814individual widgets or by redefining the class bindings.
815
816.SH KEYWORDS
817spinbox, entry, widget