ActivePerl Documentation
|
NAMETk::Balloon - pop up help balloons.
SUPPORTED PLATFORMS
SYNOPSIS
use Tk::Balloon;
...
$b = $top->Balloon(-statusbar => $status_bar_widget);
# Normal Balloon:
$b->attach($widget,
-balloonmsg => "Balloon help message",
-statusmsg => "Status bar message");
# Balloon attached to entries in a menu widget:
$b->attach($menu, -state => 'status',
-msg => ['first menu entry',
'second menu entry',
...
],
);
# Balloon attached to individual items in a canvas widget:
$b->attach($canvas, -balloonposition => 'mouse',
-msg => {'item1' => 'msg1',
'tag2' => 'msg2',
...
},
);
DESCRIPTIONBalloon 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.
Balloons and MenusIf the balloon is attached to a Menu 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 Menu as a whole. You can have separate status and balloon messages just like normal balloons.
Balloons and CanvasesIf the balloon is attached to a Canvas 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 Canvas as a whole. You can have separate status and balloon messages just like normal balloons.
OPTIONSBalloon accepts all of the options that the Frame widget accepts. In addition, the following options are also recognized.
METHODSThe Balloon widget supports only three non-standard methods:
attach(widget, options)Attaches the widget indicated by widget to the help system. The allowed options are:
detach(widget)Detaches the specified widget from the help system.
destroyDestroys the specified balloon.
EXAMPLESSee the balloon demo included with the widget demo script that came with the distribution for examples on various ways to use balloons.
NOTESBecause 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.
CAVEATSPressing 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.
BUGSHopefully none, probably some.
AUTHORSRajappa Iyer rsi@earthling.net did the original coding. Jason A. Smith <smithj4@rpi.edu> added support for menus and made some other enhancements. Slaven Rezic <eserte@cs.tu-berlin.de> added support for canvas items.
HISTORYThe 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.
|