in reply to Re^5: Balloon and menus options
in thread Balloon and menus options
A Tk::Optionmenu isa Tk::Menubutton. You want to attach a balloon to a Tk::Menu here. You can access the menu associated with a Optionmenu-button using the menu() method:
#!/usr/local/bin/perl use strict; use warnings; use Tk; use Tk::Balloon; my $mw = MainWindow->new(); $mw->title('Simple example'); my $status = $mw->Label( -width => 20, -relief => 'groove', )->pack(); my $balloon = $mw->Balloon(-statusbar => $status); my $menu = $mw->Optionmenu( -textvariable => \my $res, -options => [qw(A B C D)], )->pack(); $balloon->attach( $menu->menu, # pass the Tk::Menu instance -msg => [qw(a b c d)], #-msg => 'foo', # this works, but you get the same msg for all menu entries, of co +urse ); MainLoop;
works as expected on Linux. Windows is special in that events over Menu windows are not passed to Tk so Ballon will not work here. <Motion> bindings will not trigger here either...
And - yes: Balloon works with Listbox as well as with Canvas.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Balloon and menus options
by almut (Canon) on Dec 09, 2009 at 01:10 UTC | |
by lamprecht (Friar) on Dec 09, 2009 at 07:46 UTC |