home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _9f97eb5a61131e7d05c8f879d36ee330 < prev    next >
Text File  |  2004-06-01  |  27KB  |  820 lines

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