aplonis has asked for the wisdom of the Perl Monks concerning the following question:

I'd like to put a balloon on a menubar. I have the menu configured as/per "Mastering Perl/Tk" (copyright 2002) page 261, as shown below.

Shown is much simplified from my actual code. My menu works. My balloons also work for ordinary widgets.

What I can't figure out is how to attach a balloon to the menu. Help, please?

$mw->configure(-menu => my $menubar = $mw->Menu); # Build a menu bar for special options. map {$menubar->cascade( -label => '~' . $_->[0], menuitems => $_->[1]) +} ['First', menuitems]; # List of menu entries.... sub menuitems { [ ['command', 'Do This', -command => sub { print "foo" } ], + '', ['command', 'Do That, -command => sub { print "bar" } ], + '', ['command', 'Do Other', -command => sub { print "wtf" } ], ]; }; # Explain about the menu thingie. $balloon->attach( $mw->WHAT_SHOULD_I_PUT_HERE, -balloonmsg => 'Do something', -statusmsg => q{Tell much more here..}, );

Replies are listed 'Best First'.
Re: Attaching balloons to menubar entries...
by zentara (Cardinal) on Nov 09, 2007 at 17:27 UTC
    My guess is that you somehow need to find the subwidget(probably a label) in the menu bar to attach to. I don't even know if it is possible. Menus are nested AoA's and are a PITA.

    You might want to ask on the newsgroup comp.lang.perl.tk. I seem to remember way back, Jack D. had a piece of code that had balloons on a menu working. It was subclassed IIRC. Search groups.google.com for "Tk Jack balloon" and scroll down to "Improved Tk::Balloon !!"


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum