home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Balloon - pop up help balloons.</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Balloon - pop up help balloons.</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <UL>
-
- <LI><A HREF="#balloons and menus">Balloons and Menus</A></LI>
- <LI><A HREF="#balloons and canvases">Balloons and Canvases</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="#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>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Balloon - pop up help balloons.</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use Tk::Balloon;
- ...
- $b = $top->Balloon(-statusbar => $status_bar_widget);</PRE>
- <PRE>
- # Normal Balloon:
- $b->attach($widget,
- -balloonmsg => "Balloon help message",
- -statusmsg => "Status bar message");</PRE>
- <PRE>
- # Balloon attached to entries in a menu widget:
- $b->attach($menu, -state => 'status',
- -msg => ['first menu entry',
- 'second menu entry',
- ...
- ],
- );</PRE>
- <PRE>
- # Balloon attached to individual items in a canvas widget:
- $b->attach($canvas, -balloonposition => 'mouse',
- -msg => {'item1' => 'msg1',
- 'tag2' => 'msg2',
- ...
- },
- );</PRE>
- <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>
- <H2><A NAME="balloons and menus">Balloons and Menus</A></H2>
- <P>If the balloon is attached to a <STRONG>Menu</STRONG> widget and the message arguments
- are array references, then each element in the array will be the
- message corresponding to a menu entry. 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> as a whole.
- You can have separate status and balloon messages just like normal
- balloons.</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>
- <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><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dstate"><STRONG>-state</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dstatusbar"><STRONG>-statusbar</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dballoonposition"><STRONG>-balloonposition</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dpostcommand"><STRONG>-postcommand</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dcancelcommand"><STRONG>-cancelcommand</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dmotioncommand"><STRONG>-motioncommand</STRONG></A></STRONG><BR>
- <DD>
- 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></P></DL>
- <P>
- <HR>
- <H1><A NAME="methods">METHODS</A></H1>
- <P>The <STRONG>Balloon</STRONG> widget supports only three non-standard methods:</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><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dballoonmsg"><STRONG>-balloonmsg</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><A NAME="item_%2Dmsg"><STRONG>-msg</STRONG></A></STRONG><BR>
- <DD>
- 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></P>
- <DT><STRONG><STRONG>-initwait</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-state</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-statusbar</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-balloonposition</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-postcommand</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-cancelcommand</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><STRONG>-motioncommand</STRONG></STRONG><BR>
- <DD>
- 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></P></DL>
- <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>
- <H2><A NAME="destroy"><STRONG>destroy</STRONG></A></H2>
- <P>Destroys the specified balloon.</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>
- <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>
- <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>
- <HR>
- <H1><A NAME="bugs">BUGS</A></H1>
- <P>Hopefully none, probably some.</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> <<A HREF="mailto:smithj4@rpi.edu">smithj4@rpi.edu</A>> added support for menus and made some
- other enhancements.</P>
- <P><STRONG>Slaven Rezic</STRONG> <<A HREF="mailto:eserte@cs.tu-berlin.de">eserte@cs.tu-berlin.de</A>> added support for canvas items.</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>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Balloon - pop up help balloons.</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-