balloon.html

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

HTML
368 行
字号
<dt><strong><a name="item__2dpostcommand"><strong>-postcommand</strong></a></strong>

<dd>
<p>This option takes a <strong>CODE</strong> reference which will be executed before the
balloon and statusbar messages are displayed and should return a true
or false value to indicate whether you want the balloon to be displayed
or not. This also lets you control where the balloon is positioned by
returning a true value that looks like <em>X,Y</em> (matches this regular
expression: <code>/^(\d+),(\d+)$/</code>). If the postcommand returns a value that
matches that re then those coordinates will be used as the position to
post the balloon. <em>Warning:</em> this subroutine should return quickly or
the balloon response will appear slow.</p>
</dd>
</li>
<dt><strong><a name="item__2dcancelcommand"><strong>-cancelcommand</strong></a></strong>

<dd>
<p>This option takes a <strong>CODE</strong> reference which will be executed before the
balloon and statusbar messages are canceled and should return a true
or false value to indicate whether you want the balloon to be canceled
or not. <em>Warning:</em> this subroutine should return quickly or the balloon
response will appear slow.</p>
</dd>
</li>
<dt><strong><a name="item__2dmotioncommand"><strong>-motioncommand</strong></a></strong>

<dd>
<p>This option takes a <strong>CODE</strong> reference which will be executed for any
motion event and should return a true or false value to indicate
whether the currently displayed balloon should be canceled (deactivated).
If it returns true then the balloon will definitely be canceled, if it
returns false then it may still be canceled depending the internal rules.
<em>Note:</em> a new balloon may be posted after the <strong>-initwait</strong> time
interval, use the <strong>-postcommand</strong> option to control that behavior.
<em>Warning:</em> the subroutine should be extremely fast or the balloon
response will appear slow and consume a lot of CPU time (it is executed
every time the mouse moves over the widgets the balloon is attached to).</p>
</dd>
</li>
<dt><strong><a name="item__2dnumscreens"><strong>-numscreens</strong></a></strong>

<dd>
<p>This option accepts an integer 1 or greater. This option should be used
to avoid disjointed balloons across multiple screens in single logical
sceen (SLS) mode. This only currently works in the horizontal direction.
Example: If you are running dual screens in SLS mode then you would set
this value to 2. Default value is 1.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="methods">METHODS</a></h1>
<p>The <strong>Balloon</strong> widget supports only three non-standard methods:</p>
<p>
</p>
<h2><a name="attach_widget__options_"><strong>attach(</strong><em>widget</em>, <em>options</em><strong>)</strong></a></h2>
<p>Attaches the widget indicated by <em>widget</em> to the help system. The
allowed options are:</p>
<dl>
<dt><strong><a name="item__2dstatusmsg"><strong>-statusmsg</strong></a></strong>

<dd>
<p>The argument is the message to be shown on the status bar when the
mouse pauses over this client. If this is not specified, but
<strong>-msg</strong> is specified then the message displayed on the status bar
is the same as the argument for <strong>-msg</strong>. If you give it a scalar
reference then it is dereferenced before being displayed. Useful
if the postcommand is used to change the message.</p>
</dd>
</li>
<dt><strong><a name="item__2dballoonmsg"><strong>-balloonmsg</strong></a></strong>

<dd>
<p>The argument is the message to be displayed in the balloon that
will be popped up when the mouse pauses over this client. As with
<strong>-statusmsg</strong> if this is not specified, then it takes its value
from the <strong>-msg</strong> specification if any. If neither <strong>-balloonmsg</strong>
nor <strong>-msg</strong> are specified, or they are the empty string then
no balloon is popped up instead of an empty balloon. If you
give it a scalar reference then it is dereferenced before being
displayed. Useful if the postcommand is used to change the message.</p>
</dd>
</li>
<dt><strong><a name="item__2dmsg"><strong>-msg</strong></a></strong>

<dd>
<p>The catch-all for <strong>-statusmsg</strong> and <strong>-balloonmsg</strong>. This is a
convenient way of specifying the same message to be displayed in
both the balloon and the status bar for the client.</p>
</dd>
</li>
<dt><strong><strong>-initwait</strong></strong>

<dt><strong><strong>-state</strong></strong>

<dt><strong><strong>-statusbar</strong></strong>

<dt><strong><strong>-balloonposition</strong></strong>

<dt><strong><strong>-postcommand</strong></strong>

<dt><strong><strong>-cancelcommand</strong></strong>

<dt><strong><strong>-motioncommand</strong></strong>

<dd>
<p>These options allow you to override the balloon's default value for
those option for some of the widgets it is attached to. It accepts the
same values as above and will default to the <strong>Balloon</strong>'s value.</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="detach_widget_"><strong>detach(</strong><em>widget</em><strong>)</strong></a></h2>
<p>Detaches the specified <em>widget</em> from the help system.</p>
<p>
</p>
<h2><a name="destroy"><strong>destroy</strong></a></h2>
<p>Destroys the specified balloon.</p>
<p>
</p>
<hr />
<h1><a name="advertised_subwidgets">ADVERTISED SUBWIDGETS</a></h1>
<p>The balloon label is advertised as <code>message</code>.</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>See the balloon demo included with the widget demo script that came with
the distribution for examples on various ways to use balloons.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>Because of the overhead associated with each balloon you create (from
tracking the mouse movement to know when to activate and deactivate
them) you will see the best performance (low CPU consumption) if you
create as few balloons as possible and attach them to as many widgets
as you can.  In other words, don't create a balloon for each widget
you want to attach one to.</p>
<p>
</p>
<hr />
<h1><a name="caveats">CAVEATS</a></h1>
<p>Pressing any button will deactivate (cancel) the current balloon,
if one exists. You can usually make the balloon reappear by moving
the mouse a little. Creative use of the 3 command options can help
you out also. If the mouse is over the balloon when a menu is unposted
then the balloon will remain until you move off of it.</p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>If using balloons attached to listbox entries or canvas items in a
scrolled widget, then the subwidget have to be used:</p>
<pre>
    <span class="variable">$balloon</span><span class="operator">-&gt;</span><span class="variable">attach</span><span class="operator">(</span><span class="variable">$w</span><span class="operator">-&gt;</span><span class="variable">Subwidget</span><span class="operator">(</span><span class="string">"scrolled"</span><span class="operator">),</span> <span class="string">-msg</span> <span class="operator">=&gt;</span> <span class="operator">...);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="authors">AUTHORS</a></h1>
<p><strong>Rajappa Iyer</strong> <a href="mailto:rsi@earthling.net">rsi@earthling.net</a> did the original coding.</p>
<p><strong>Jason A. Smith</strong> &lt;<a href="mailto:smithj4@rpi.edu">smithj4@rpi.edu</a>&gt; added support for menus and made some
other enhancements.</p>
<p><strong>Slaven Rezic</strong> &lt;<a href="mailto:eserte@cs.tu-berlin.de">eserte@cs.tu-berlin.de</a>&gt; added support for canvas items.</p>
<p><strong>Gerhard Petrowitsch</strong> &lt;<a href="mailto:gerhard@petrowitsch.de">gerhard@petrowitsch.de</a>&gt; added intelligent positioning</p>
<p><strong>Jack Dunnigan</strong> &lt;<a href="mailto:dunniganj@cpan.org">dunniganj@cpan.org</a>&gt; Made positioning <em>more</em> intelligent and
added support for multiple monitors under single logical screen.</p>
<p>
</p>
<hr />
<h1><a name="history">HISTORY</a></h1>
<p>The code and documentation was derived from Balloon.tcl from the
Tix4.0 distribution by Ioi Lam and modified by the above mentioned
authors. This code may be redistributed under the same terms as Perl.</p>

</body>

</html>

⌨️ 快捷键说明

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