scrollbar.html

来自「perl教程」· HTML 代码 · 共 523 行 · 第 1/2 页

HTML
523 行
字号
<?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::Scrollbar - Create and manipulate Scrollbar 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::Scrollbar - Create and manipulate Scrollbar 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="#standard_options">STANDARD OPTIONS</a></li>
	<li><a href="#widgetspecific_options">WIDGET-SPECIFIC OPTIONS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#elements">ELEMENTS</a></li>
	<li><a href="#widget_methods">WIDGET METHODS</a></li>
	<li><a href="#scrolling_commands">SCROLLING COMMANDS</a></li>
	<li><a href="#old_command_syntax">OLD COMMAND SYNTAX</a></li>
	<li><a href="#bindings">BINDINGS</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#keywords">KEYWORDS</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Tk::Scrollbar - Create and manipulate Scrollbar widgets</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p><em>$scrollbar</em> = <em>$parent</em>-&gt;<strong>Scrollbar</strong>(?<em>options</em>?);</p>
<p>
</p>
<hr />
<h1><a name="standard_options">STANDARD OPTIONS</a></h1>
<p><table cellspacing="0" cellpadding="0"><tr><td><strong>-activebackground</strong><td><strong>-highlightbackground</strong><td><strong>-orient</strong><td><strong>-takefocus</strong>
<tr><td><strong>-background</strong><td><strong>-highlightcolor</strong><td><strong>-relief</strong><td><strong>-troughcolor</strong>
<tr><td><strong>-borderwidth</strong><td><strong>-highlightthickness</strong><td><strong>-repeatdelay</strong>
<tr><td><strong>-cursor</strong><td><strong>-jump</strong><td><strong>-repeatinterval</strong></table></p>
<p>See <a href="../../lib/Tk/options.html">the Tk::options manpage</a> for details of the standard options.</p>
<p>
</p>
<hr />
<h1><a name="widgetspecific_options">WIDGET-SPECIFIC OPTIONS</a></h1>
<dl>
<dt><strong><a name="item_name_3a_activerelief">Name:	<strong>activeRelief</strong></a></strong>

<dt><strong><a name="item_class_3a_activerelief">Class:	<strong>ActiveRelief</strong></a></strong>

<dt><strong><a name="item_switch_3a__2dactiverelief">Switch:	<strong>-activerelief</strong></a></strong>

<dd>
<p>Specifies the relief to use when displaying the element that is
active, if any.
Elements other than the active element are always displayed with
a raised relief.</p>
</dd>
</li>
<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>

<dt><strong><a name="item_switch_3a__2dcommand">Switch:	<strong>-command</strong></a></strong>

<dd>
<p>Specifies a callback to invoke to change the view
in the widget associated with the scrollbar.  When a user requests
a view change by manipulating the scrollbar, the callback is
invoked.  The callback is passed
additional arguments as described later. This option almost always has
a value such as <strong>[xview =&gt; $widget]</strong> or <strong>[yview =&gt; $widget]</strong>, consisting of the
a widget object and either <strong>xview</strong> (if the scrollbar is for
horizontal scrolling) or <strong>yview</strong> (for vertical scrolling).
All scrollable widgets have <strong>xview</strong> and <strong>yview</strong> methods
that take exactly the additional arguments appended by the scrollbar
as described in <a href="#scrolling_commands">SCROLLING COMMANDS</a> below.</p>
</dd>
</li>
<dt><strong><a name="item_name_3a_elementborderwidth">Name:	<strong>elementBorderWidth</strong></a></strong>

<dt><strong><a name="item_class_3a_borderwidth">Class:	<strong>BorderWidth</strong></a></strong>

<dt><strong><a name="item_switch_3a__2delementborderwidth">Switch:	<strong>-elementborderwidth</strong></a></strong>

<dd>
<p>Specifies the width of borders drawn around the internal elements
of the scrollbar (the two arrows and the slider).  The value may
have any of the forms acceptable to <strong>Tk_GetPixels</strong>.
If this value is less than zero, the value of the <strong>borderWidth</strong>
option is used in its place.</p>
</dd>
</li>
<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>

<dt><strong><a name="item_switch_3a__2dwidth">Switch:	<strong>-width</strong></a></strong>

<dd>
<p>Specifies the desired narrow dimension of the scrollbar window,
not including 3-D border, if any.  For vertical
scrollbars this will be the width and for horizontal scrollbars
this will be the height.
The value may have any of the forms acceptable to <strong>Tk_GetPixels</strong>.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>Scrollbar</strong> method creates a new window (given by the
$widget argument) and makes it into a scrollbar widget.
Additional options, described above, may be specified on the command
line or in the option database to configure aspects of the scrollbar
such as its colors, orientation, and relief.
The <strong>scrollbar</strong> command returns its $widget argument.
At the time this command is invoked, there must not exist a window
named $widget, but $widget's parent must exist.</p>
<p>A scrollbar is a widget that displays two arrows, one at each end of
the scrollbar, and a <em>slider</em> in the middle portion of the
scrollbar.
It provides information about what is visible in an <em>associated window</em>
that displays an document of some sort (such as a file being edited or
a drawing).
The position and size of the slider indicate which portion of the
document is visible in the associated window.  For example, if the
slider in a vertical scrollbar covers the top third of the area
between the two arrows, it means that the associated window displays
the top third of its document.</p>
<p>Scrollbars can be used to adjust the view in the associated window
by clicking or dragging with the mouse.
See <a href="#bindings">BINDINGS</a> below for details.</p>
<p>
</p>
<hr />
<h1><a name="elements">ELEMENTS</a></h1>
<p>A scrollbar displays five elements, which are referred to in the
methods for the scrollbar:</p>
<dl>
<dt><strong><a name="item_arrow1"><strong>arrow1</strong></a></strong>

<dd>
<p>The top or left arrow in the scrollbar.</p>
</dd>
</li>
<dt><strong><a name="item_trough1"><strong>trough1</strong></a></strong>

<dd>
<p>The region between the slider and <strong>arrow1</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_slider"><strong>slider</strong></a></strong>

<dd>
<p>The rectangle that indicates what is visible in the associated widget.</p>
</dd>
</li>
<dt><strong><a name="item_trough2"><strong>trough2</strong></a></strong>

<dd>
<p>The region between the slider and <strong>arrow2</strong>.</p>
</dd>
</li>
<dt><strong><a name="item_arrow2"><strong>arrow2</strong></a></strong>

<dd>
<p>The bottom or right arrow in the scrollbar.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="widget_methods">WIDGET METHODS</a></h1>
<p>The <strong>Scrollbar</strong> method creates a widget object.
This object supports the <strong>configure</strong> and <strong>cget</strong> methods
described in <a href="../../lib/Tk/options.html">the Tk::options manpage</a> which can be used to enquire and
modify the options described above.
The widget also inherits all the methods provided by the generic
<a href="../../lib/Tk/Widget.html">Tk::Widget</a> class.</p>
<p>The following additional methods are available for scrollbar widgets:</p>
<dl>
<dt><strong><a name="item_activate"><em>$scrollbar</em>-&gt;<strong>activate</strong>(?<em>element</em>?)</a></strong>

<dd>
<p>Marks the element indicated by <em>element</em> as active, which
causes it to be displayed as specified by the <strong>activeBackground</strong>
and <strong>activeRelief</strong> options.
The only element values understood by this command are <strong>arrow1</strong>,
<strong>slider</strong>, or <strong>arrow2</strong>.
If any other value is specified then no element of the scrollbar
will be active.
If <em>element</em> is not specified, the command returns
the name of the element that is currently active, or an empty string
if no element is active.</p>
</dd>
</li>
<dt><strong><a name="item_delta"><em>$scrollbar</em>-&gt;<strong>delta</strong>(<em>deltaX, deltaY</em>)</a></strong>

<dd>
<p>Returns a real number indicating the fractional change in
the scrollbar setting that corresponds to a given change
in slider position.  For example, if the scrollbar is horizontal,
the result indicates how much the scrollbar setting must change
to move the slider <em>deltaX</em> pixels to the right (<em>deltaY</em> is
ignored in this case).
If the scrollbar is vertical, the result indicates how much the
scrollbar setting must change to move the slider <em>deltaY</em> pixels
down.  The arguments and the result may be zero or negative.</p>
</dd>
</li>
<dt><strong><a name="item_fraction"><em>$scrollbar</em>-&gt;<strong>fraction</strong>(<em>x, y</em>)</a></strong>

<dd>
<p>Returns a real number between 0 and 1 indicating where the point
given by <em>x</em> and <em>y</em> lies in the trough area of the scrollbar.
The value 0 corresponds to the top or left of the trough, the
value 1 corresponds to the bottom or right, 0.5 corresponds to
the middle, and so on.
<em>X</em> and <em>y</em> must be pixel coordinates relative to the scrollbar
widget.
If <em>x</em> and <em>y</em> refer to a point outside the trough, the closest
point in the trough is used.</p>
</dd>
</li>
<dt><strong><a name="item_get"><em>$scrollbar</em>-&gt;<strong>get</strong></a></strong>

<dd>
<p>Returns the scrollbar settings in the form of a list whose
elements are the arguments to the most recent <strong>set</strong> method.</p>
</dd>
</li>
<dt><strong><a name="item_identify"><em>$scrollbar</em>-&gt;<strong>identify</strong>(<em>x, y</em>)</a></strong>

<dd>
<p>Returns the name of the element under the point given by <em>x</em> and
<em>y</em> (such as <strong>arrow1</strong>), or an empty string if the point does
not lie in any element of the scrollbar.
<em>X</em> and <em>y</em> must be pixel coordinates relative to the scrollbar
widget.</p>
</dd>
</li>

⌨️ 快捷键说明

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