From: rocket777 on
I have made a copy of the library code tk_optionMenu so I can make
some changes (font etc.) I also would like to change it to add
bindings for page up and down.

It already comes with bindings for up and down arrow. If my menu has
hundreds of items, I can scroll up/down with the arrow keys, but it
takes a while to get to something a few hundred down. I would like to
bind page up/down to scroll say, 25 at a time. I've tried binding to
the menu that is created by tk_optionMenu, but that didn't work.

Any ideas? Here's the code as I've slightly modified it so far (just
to add the font changes and a puts for debugging). When I call this,
args typically might be 500 items long.


proc mytk_optionMenu {w varName firstValue args} {
upvar #0 $varName var
set ft {courier 10}
if {![info exists var]} {
set var $firstValue
}
menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu
-relief raised -highlightthickness 1 -anchor c -direction flush -font
$ft
menu $w.menu -tearoff 0
$w.menu add radiobutton -label $firstValue -variable $varName -
font $ft -command auto_ok
foreach i $args {
$w.menu add radiobutton -label $i -variable $varName -font $ft -
command auto_ok
puts "label = $i"
}

return $w.menu
}