Re: Scrollbar with Optionmenu




"Penguin_X" <penguin_x@xxxxxxxxxxxx> wrote in message
news:z38Re.18223$j63.818460@xxxxxxxxxxxxxxxxxxxxxxx
> Hi !
>
> I've a little problem with "Optionmenu" method. You know, when you have
> too much variables, the option bar is too long and you can't see all the
> list. Is there a scrollbar command for this method or something that
> could "split" the list in two or three parts ???
>
Yes. Optionmenu is a derived Menubutton widget which allows direct access to
the menu. You only need to configure a columnbreak attribute at the
appropriate menu entries.

[snip]

use Tk;
use Tk::Optionmenu;
use strict;
my @allminutes = map{sprintf("%2.2d",$_)} (0..59);
my $theminute;
my $mw = tkinit;
my $om = $mw->Optionmenu(
-command=> sub {
print "$theminute \n";
} ,
-textvariable=> \$theminute ,
-options=> [
@allminutes
],
)->pack;
my $menu = $om->menu;
for (my $i=10; $i<60; $i+=10) {
$menu->entryconfigure($i,-columnbreak=>1);
}
MainLoop;

__END__

Jack


.