in reply to Tk Optionmenu question

Your problem lies in that you don't want the Optionmenu itself scrolled -- you want the drop-down which it shows to be scrolled. Unfortunatly, what Tk thinks you're trying to do is the former. It's also not in your favor that Optionmenus drop down Menus -- which, if I'm remembering correctly, can't be scrolled in the first place.

Luckily, you're not the first person to want to have a large pop-up list. Look at the BrowseEntry widget, which is automatically scrolled.

Update: Here's some code which should do more of less what you want:

my $day_menu = $date_frame->BroseEntry( -state => "readonly", -choices => [(1..$days{$month} +)], -variable => \$day_number )->pack( -side=> "left" );

perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Replies are listed 'Best First'.
Re: Re: Tk Optionmenu question
by thor (Priest) on Jan 28, 2002 at 23:02 UTC
    This is fantastic! Now all I have to do is find a way to alter the width of the box as it sits in the main window and I'll be golden.

    Thanks again

      One solution is to add -width => 42 in the code for creating the BrowseEntry. The other option is to diddle with the arguments to pack, specifically the -expand and -grow options.

      perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

        You're too good. I was going to fiddle with this when I got a chance, but as it turns out, you beat me to the punch!

        Thanks again.