spinbox.html

来自「perl教程」· HTML 代码 · 共 1,002 行 · 第 1/3 页

HTML
1,002
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Tk::Spinbox - Create and manipulate Spinbox widgets</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>Tk::Spinbox - Create and manipulate Spinbox widgets</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#widgetspecific_options">WIDGET-SPECIFIC OPTIONS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#validation">VALIDATION</a></li>
	<li><a href="#widget_methods">WIDGET METHODS</a></li>
	<li><a href="#default_bindings">DEFAULT BINDINGS</a></li>
	<li><a href="#keywords">KEYWORDS</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Tk::Spinbox - Create and manipulate Spinbox widgets</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p><em>$spinbox</em> =  <em>$parent</em>-&gt;Spinbox(?<em>options</em>?);</p>
<pre>
 -activebackground    -highlightthickness -repeatinterval
 -background          -insertbackground   -selectbackground
 -borderwidth         -insertborderwidth  -selectborderwidth
 -cursor              -insertontime       -selectforeground
 -exportselection     -insertwidth        -takefocus
 -font                -insertofftime      -textvariable
 -foreground          -justify            -xscrollcommand
 -highlightbackground -relief
 -highlightcolor      -repeatdelay</pre>
<p>
</p>
<hr />
<h1><a name="widgetspecific_options">WIDGET-SPECIFIC OPTIONS</a></h1>
<dl>
<dt><strong><a name="item_option_3a__2dbuttonbackground">Option:	<strong>-buttonbackground</strong></a></strong>

<dt><strong><a name="item_name_3a_buttonbackground">Name:	<strong>buttonBackground</strong></a></strong>

<dt><strong><a name="item_class_3a_background">Class:	<strong>Background</strong></a></strong>

<dd>
<p>The background color to be used for the spin buttons.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dbuttoncursor">Option:	<strong>-buttoncursor</strong></a></strong>

<dt><strong><a name="item_name_3a_buttoncursor">Name:	<strong>buttonCursor</strong></a></strong>

<dt><strong><a name="item_class_3a_cursor">Class:	<strong>Cursor</strong></a></strong>

<dd>
<p>The cursor to be used when over the spin buttons.  If this is empty
(the default), a default cursor will be used.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dbuttondownrelief">Option:	<strong>-buttondownrelief</strong></a></strong>

<dt><strong><a name="item_name_3a_buttondownrelief">Name:	<strong>buttonDownRelief</strong></a></strong>

<dt><strong><a name="item_class_3a_relief">Class:	<strong>Relief</strong></a></strong>

<dd>
<p>The relief to be used for the upper spin button.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dbuttonuprelief">Option:	<strong>-buttonuprelief</strong></a></strong>

<dt><strong><a name="item_name_3a_buttonuprelief">Name:	<strong>buttonUpRelief</strong></a></strong>

<dt><strong>Class:	<strong>Relief</strong></strong>

<dd>
<p>The relief to be used for the lower spin button.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dcommand">Option:	<strong>-command</strong></a></strong>

<dt><strong><a name="item_name_3a_command">Name:	<strong>command</strong></a></strong>

<dt><strong><a name="item_class_3a_command">Class:	<strong>Command</strong></a></strong>

<dd>
<p>Specifies a Perl/Tk callback to invoke whenever a Spinbutton is invoked.
The callback has these two arguments <em>appended</em> to any existing callback
arguments: the current value of the widget and the direction of the button
press (<strong>up</strong> or <strong>down</strong>).</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2ddisabledbackground">Option:	<strong>-disabledbackground</strong></a></strong>

<dt><strong><a name="item_name_3a_disabledbackground">Name:	<strong>disabledBackground</strong></a></strong>

<dt><strong><a name="item_class_3a_disabledbackground">Class:	<strong>DisabledBackground</strong></a></strong>

<dd>
<p>Specifies the background color to use when the Spinbox is disabled.  If
this option is the empty string, the normal background color is used.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2ddisabledforeground">Option:	<strong>-disabledforeground</strong></a></strong>

<dt><strong><a name="item_name_3a_disabledforeground">Name:	<strong>disabledForeground</strong></a></strong>

<dt><strong><a name="item_class_3a_disabledforeground">Class:	<strong>DisabledForeground</strong></a></strong>

<dd>
<p>Specifies the foreground color to use when the Spinbox is disabled.  If
this option is the empty string, the normal foreground color is used.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dformat">Option:	<strong>-format</strong></a></strong>

<dt><strong><a name="item_name_3a_format">Name:	<strong>format</strong></a></strong>

<dt><strong><a name="item_class_3a_format">Class:	<strong>Format</strong></a></strong>

<dd>
<p>Specifies an alternate format to use when setting the string value
when using the <strong>-from</strong> and <strong>-to</strong> range.
This must be a format specifier of the form <strong>%&lt;pad&gt;.&lt;pad&gt;f</strong>,
as it will format a floating-point number.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dfrom">Option:	<strong>-from</strong></a></strong>

<dt><strong><a name="item_name_3a_from">Name:	<strong>from</strong></a></strong>

<dt><strong><a name="item_class_3a_from">Class:	<strong>From</strong></a></strong>

<dd>
<p>A floating-point value corresponding to the lowest value for a Spinbox, to
be used in conjunction with <strong>-to</strong> and <strong>-increment</strong>.  When all
are specified correctly, the Spinbox will use these values to control its
contents.  This value must be less than the <strong>-to</strong> option.
If <strong>-values</strong> is specified, it supercedes this option.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dinvalidcommand">Option:	<strong>-invalidcommand</strong></a></strong>

<dt><strong><a name="item_alias_3a__2dinvcmd">Alias:	<strong>-invcmd</strong></a></strong>

<dt><strong><a name="item_name_3a_invalidcommand">Name:	<strong>invalidCommand</strong></a></strong>

<dt><strong><a name="item_class_3a_invalidcommand">Class:	<strong>InvalidCommand</strong></a></strong>

<dd>
<p>Specifies a script to eval when <strong>validateCommand</strong> returns 0.  Setting
it to an empty string disables this feature (the default).  The best use of
this option is to set it to <em>bell</em>.  See <strong>Validation</strong> below for
more information.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dincrement">Option:	<strong>-increment</strong></a></strong>

<dt><strong><a name="item_name_3a_increment">Name:	<strong>increment</strong></a></strong>

<dt><strong><a name="item_class_3a_increment">Class:	<strong>Increment</strong></a></strong>

<dd>
<p>A floating-point value specifying the increment.  When used with
<strong>-from</strong> and <strong>-to</strong>, the value in the widget will be adjusted by
<strong>-increment</strong> when a spin button is pressed (up adds the value,
down subtracts the value).</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dreadonlybackground">Option:	<strong>-readonlybackground</strong></a></strong>

<dt><strong><a name="item_name_3a_readonlybackground">Name:	<strong>readonlyBackground</strong></a></strong>

<dt><strong><a name="item_class_3a_readonlybackground">Class:	<strong>ReadonlyBackground</strong></a></strong>

<dd>
<p>Specifies the background color to use when the Spinbox is readonly.  If
this option is the empty string, the normal background color is used.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dstate">Option:	<strong>-state</strong></a></strong>

<dt><strong><a name="item_name_3a_state">Name:	<strong>state</strong></a></strong>

<dt><strong><a name="item_class_3a_state">Class:	<strong>State</strong></a></strong>

<dd>
<p>Specifies one of three states for the Spinbox:  <strong>normal</strong>,
<strong>disabled</strong>, or <strong>readonly</strong>.  If the Spinbox is readonly, then the
value may not be changed using methods and no insertion cursor
will be displayed, even if the input focus is in the widget; the
contents of the widget may still be selected.  If the Spinbox is
disabled, the value may not be changed, no insertion cursor will be
displayed, the contents will not be selectable, and the Spinbox may
be displayed in a different color, depending on the values of the
<strong>-disabledforeground</strong> and <strong>-disabledbackground</strong> options.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dto">Option:	<strong>-to</strong></a></strong>

<dt><strong><a name="item_name_3a_to">Name:	<strong>to</strong></a></strong>

<dt><strong><a name="item_class_3a_to">Class:	<strong>To</strong></a></strong>

<dd>
<p>A floating-point value corresponding to the highest value for the Spinbox,
to be used in conjunction with <strong>-from</strong> and <strong>-increment</strong>.  When
all are specified correctly, the Spinbox will use these values to control
its contents.  This value must be greater than the <strong>-from</strong> option.
If <strong>-values</strong> is specified, it supercedes this option.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dvalidate">Option:	<strong>-validate</strong></a></strong>

<dt><strong><a name="item_name_3a_validate">Name:	<strong>validate</strong></a></strong>

<dt><strong><a name="item_class_3a_validate">Class:	<strong>Validate</strong></a></strong>

<dd>
<p>Specifies the mode in which validation should operate: <strong>none</strong>,
<strong>focus</strong>, <strong>focusin</strong>, <strong>focusout</strong>, <strong>key</strong>, or <strong>all</strong>.
It defaults to <strong>none</strong>.  When you want validation, you must explicitly
state which mode you wish to use.  See <strong>Validation</strong> below for more.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dvalidatecommand">Option:	<strong>-validatecommand</strong></a></strong>

<dt><strong><a name="item_alias_3a__2dvcmd">Alias:	<strong>-vcmd</strong></a></strong>

<dt><strong><a name="item_name_3a_validatecommand">Name:	<strong>validateCommand</strong></a></strong>

<dt><strong><a name="item_class_3a_validatecommand">Class:	<strong>ValidateCommand</strong></a></strong>

<dd>
<p>Specifies a script to evaluate when you want to validate the input in the
widget.  Setting it to an empty string disables this feature (the default).
Validation occurs according to the value of <strong>-validate</strong>.
This command must return a valid boolean value.  If it returns 0 (or
the valid boolean equivalent) then the value of the widget will not
change and the <strong>invalidCommand</strong> will be evaluated if it is set.  If it
returns 1, then value will be changed.
See <strong>Validation</strong> below for more information.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dvalues">Option:	<strong>-values</strong></a></strong>

<dt><strong><a name="item_name_3a_values">Name:	<strong>values</strong></a></strong>

<dt><strong><a name="item_class_3a_values">Class:	<strong>Values</strong></a></strong>

<dd>
<p>Must be a proper list value.  If specified, the Spinbox will use these
values as to control its contents, starting with the first value.  This
option has precedence over the <strong>-from</strong> and <strong>-to</strong> range.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dwidth">Option:	<strong>-width</strong></a></strong>

<dt><strong><a name="item_name_3a_width">Name:	<strong>width</strong></a></strong>

<dt><strong><a name="item_class_3a_width">Class:	<strong>Width</strong></a></strong>

<dd>
<p>Specifies an integer value indicating the desired width of the Spinbox window,
in average-size characters of the widget's font.
If the value is less than or equal to zero, the widget picks a
size just large enough to hold its current text.</p>
</dd>
</li>
<dt><strong><a name="item_option_3a__2dwrap">Option:	<strong>-wrap</strong></a></strong>

<dt><strong><a name="item_name_3a_wrap">Name:	<strong>wrap</strong></a></strong>

<dt><strong><a name="item_class_3a_wrap">Class:	<strong>Wrap</strong></a></strong>

<dd>
<p>Must be a proper boolean value.  If on, the Spinbox will wrap around the
values of data in the widget.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>Spinbox</strong> method creates a new window (given by the
$spinbox argument) and makes it into a Spinbox widget.
Additional options, described above, may be specified on the
command line or in the option database
to configure aspects of the Spinbox such as its colors, font,
and relief.</p>
<p>A <strong>Spinbox</strong> is an extended <strong>Entry</strong> widget that allows he user
to move, or spin, through a fixed set of ascending or descending values
such as times or dates in addition to editing the value as in an
<strong>entry</strong>.  When first created, a Spinbox's string is empty.
A portion of the Spinbox may be selected as described below.
If a Spinbox is exporting its selection (see the <strong>exportSelection</strong>
option), then it will observe the standard protocols for handling the
selection;  Spinbox selections are available as type <strong>STRING</strong>.
Spinboxes also observe the standard Tk rules for dealing with the
input focus.  When a Spinbox has the input focus it displays an
<em>insertion cursor</em> to indicate where new characters will be
inserted.</p>
<p>Spinboxes are capable of displaying strings that are too long to
fit entirely within the widget's window.  In this case, only a
portion of the string will be displayed; commands described below
may be used to change the view in the window.  Spinboxes use
the standard <strong>-xscrollcommand</strong> mechanism for interacting with
scrollbars (see the description of the <strong>-xscrollcommand</strong> option
for details).  They also support scanning, as described below.</p>
<p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?