balloon.html

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

HTML
368
字号
<?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::Balloon - pop up help balloons.</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::Balloon - pop up help balloons.</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="#description">DESCRIPTION</a></li>
	<ul>

		<li><a href="#balloons_and_menus_or_listboxes">Balloons and Menus or Listboxes</a></li>
		<li><a href="#balloons_and_canvases">Balloons and Canvases</a></li>
		<li><a href="#balloon_position">Balloon Position</a></li>
	</ul>

	<li><a href="#options">OPTIONS</a></li>
	<li><a href="#methods">METHODS</a></li>
	<ul>

		<li><a href="#attach_widget__options_"><strong>attach(</strong><em>widget</em>, <em>options</em><strong>)</strong></a></li>
		<li><a href="#detach_widget_"><strong>detach(</strong><em>widget</em><strong>)</strong></a></li>
		<li><a href="#destroy"><strong>destroy</strong></a></li>
	</ul>

	<li><a href="#advertised_subwidgets">ADVERTISED SUBWIDGETS</a></li>
	<li><a href="#examples">EXAMPLES</a></li>
	<li><a href="#notes">NOTES</a></li>
	<li><a href="#caveats">CAVEATS</a></li>
	<li><a href="#bugs">BUGS</a></li>
	<li><a href="#authors">AUTHORS</a></li>
	<li><a href="#history">HISTORY</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Tk::Balloon - pop up help balloons.</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">Tk::Balloon</span><span class="operator">;</span>
    <span class="operator">...</span>
    <span class="variable">$b</span> <span class="operator">=</span> <span class="variable">$top</span><span class="operator">-&gt;</span><span class="variable">Balloon</span><span class="operator">(</span><span class="string">-statusbar</span> <span class="operator">=&gt;</span> <span class="variable">$status_bar_widget</span><span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Normal Balloon:</span>
    <span class="variable">$b</span><span class="operator">-&gt;</span><span class="variable">attach</span><span class="operator">(</span><span class="variable">$widget</span><span class="operator">,</span>
               <span class="string">-balloonmsg</span> <span class="operator">=&gt;</span> <span class="string">"Balloon help message"</span><span class="operator">,</span>
               <span class="string">-statusmsg</span> <span class="operator">=&gt;</span> <span class="string">"Status bar message"</span><span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Balloon attached to entries in a menu widget:</span>
    <span class="variable">$b</span><span class="operator">-&gt;</span><span class="variable">attach</span><span class="operator">(</span><span class="variable">$menu</span><span class="operator">,</span> <span class="string">-state</span> <span class="operator">=&gt;</span> <span class="string">'status'</span><span class="operator">,</span>
                      <span class="string">-msg</span> <span class="operator">=&gt;</span> <span class="operator">[</span><span class="string">'first menu entry'</span><span class="operator">,</span>
                               <span class="string">'second menu entry'</span><span class="operator">,</span>
                               <span class="operator">...</span>
                              <span class="operator">]</span><span class="operator">,</span>
              <span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Balloon attached to individual items in a canvas widget:</span>
    <span class="variable">$b</span><span class="operator">-&gt;</span><span class="variable">attach</span><span class="operator">(</span><span class="variable">$canvas</span><span class="operator">,</span> <span class="string">-balloonposition</span> <span class="operator">=&gt;</span> <span class="string">'mouse'</span><span class="operator">,</span>
                        <span class="string">-msg</span> <span class="operator">=&gt;</span> <span class="operator">{</span><span class="string">'item1'</span> <span class="operator">=&gt;</span> <span class="string">'msg1'</span><span class="operator">,</span>
                                 <span class="string">'tag2'</span>  <span class="operator">=&gt;</span> <span class="string">'msg2'</span><span class="operator">,</span>
                                  <span class="operator">...</span>
                                <span class="operator">}</span><span class="operator">,</span>
              <span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Balloon attached to items in a listbox widget:</span>
    <span class="variable">$b</span><span class="operator">-&gt;</span><span class="variable">attach</span><span class="operator">(</span><span class="variable">$listbox</span><span class="operator">,</span> <span class="string">-balloonposition</span> <span class="operator">=&gt;</span> <span class="string">'mouse'</span><span class="operator">,</span>
                         <span class="string">-msg</span> <span class="operator">=&gt;</span> <span class="operator">[</span><span class="string">'first listbox element'</span><span class="operator">,</span>
                                  <span class="string">'2nd listbox element'</span><span class="operator">,</span>
                                  <span class="operator">...</span>
                                 <span class="operator">]</span><span class="operator">,</span>
              <span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><strong>Balloon</strong> provides the framework to create and attach help
balloons to various widgets so that when the mouse pauses over the
widget for more than a specified amount of time, a help balloon is
popped up.</p>
<p>
</p>
<h2><a name="balloons_and_menus_or_listboxes">Balloons and Menus or Listboxes</a></h2>
<p>If the balloon is attached to a <strong>Menu</strong> or <strong>Listbox</strong> widget and the
message arguments are array references, then each element in the array
will be the message corresponding to a menu entry or listbox element.
The balloon message will then be shown for the entry which the mouse
pauses over. Otherwise it is assumed that the balloon is to be
attached to the <strong>Menu</strong> or <strong>Listbox</strong> as a whole. You can have
separate status and balloon messages just like normal balloons.</p>
<p>
</p>
<h2><a name="balloons_and_canvases">Balloons and Canvases</a></h2>
<p>If the balloon is attached to a <strong>Canvas</strong> widget and the message
arguments are hash references, then each hash key should correspond to
a canvas item ID or tag and the associated value will correspond to the
message for that canvas item. The balloon message will then be shown for
the current item (the one at the position of the mouse). Otherwise it is
assumed that the balloon is to be attached to the <strong>Canvas</strong> as a whole.
You can have separate status and balloon messages just like normal
balloons.</p>
<p>
</p>
<h2><a name="balloon_position">Balloon Position</a></h2>
<p>By default, the balloon pops up at the lower right side of the client.
If it would extend outside the lower screen border, its positioned at the
upper right side. If it would extend outside the right screen border
it's shown on the lower left side of the client. If it would extend
outside both the lower and the right screen border, it's positioned
at the upper left side of the client. Thus, the little arrow always
points to the attached client.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<p><strong>Balloon</strong> accepts all of the options that the <strong>Frame</strong> widget
accepts. In addition, the following options are also recognized.</p>
<dl>
<dt><strong><a name="item__2dinitwait"><strong>-initwait</strong></a></strong>

<dd>
<p>Specifies the amount of time to wait without activity before
popping up a help balloon. Specified in milliseconds. Defaults to
350 milliseconds. This applies to both the popped up balloon and
the status bar message.</p>
</dd>
</li>
<dt><strong><a name="item__2dstate"><strong>-state</strong></a></strong>

<dd>
<p>Can be one of <strong>'balloon'</strong>, <strong>'status'</strong>, <strong>'both'</strong> or <strong>'none'</strong>
indicating that the help balloon, status bar help, both or none
respectively should be activated when the mouse pauses over the
client widget. Default is <strong>'both'</strong>.</p>
</dd>
</li>
<dt><strong><a name="item__2dstatusbar"><strong>-statusbar</strong></a></strong>

<dd>
<p>Specifies the widget used to display the status message. This
widget should accept the <strong>-text</strong> option and is typically a
<strong>Label</strong>. If the widget accepts the <strong>-textvariable</strong> option and
that option is defined then it is used instead of the <strong>-text</strong>
option.</p>
</dd>
</li>
<dt><strong><a name="item__2dballoonposition"><strong>-balloonposition</strong></a></strong>

<dd>
<p>Can be one of <strong>'widget'</strong> or <strong>'mouse'</strong>. It controls where the balloon
will popup. <strong>'widget'</strong> makes the balloon appear at the lower right
corner of the widget it is attached to (default), and <strong>'mouse'</strong> makes
the balloon appear below and to the right of the current mouse position.</p>
</dd>
</li>

⌨️ 快捷键说明

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