The bug occurs when tk_popup tries to post a menu at
a position that does not allow to display the full menu
height on screen.
The problem can be reproduced with this simple script
to launch in wish:
menu .m
for {set i 0} {$i<15} {incr i} {
.m add command -label "hello $i"
}
bind . <Button-1> { \
tk_popup .m \
[winfo pointerx .] \
[winfo pointery .] \
}
Enlarge or move the . window so as its lower border is
near the lower border of the screen and click button-1 in
this area.
Since the menu is too tall to fit in the screen if the first
line is placed at the cursor position, Tk computes a new
placement point of the menu.
This computation must be incorrect since the menu is
posted much too far away upwards.
Note however that the behaviour appears to be OK wrt
the right side of the screen.
This is with Tck/Tk 8.4.11.
It is OK with 8.5 alpha release.
Logged In: YES
user_id=812825
proc tk::PostOverPoint should be changed to the following:
global tcl_platform
if {[string compare $entry {}]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] +
[winfo reqheight $menu])/2}]
} else {
incr y [expr {-([$menu yposition $entry] +
[$menu yposition [expr {$entry+1}]])/2}]
}
incr x [expr {-[winfo reqwidth $menu]/2}]
}
$menu post $x $y
if {$entry ne "" && [$menu entrycget $entry -state]
ne "disabled"} {
$menu activate $entry
GenerateMenuSelect $menu
}
Logged In: YES
user_id=72656
Backported fix that was used for 8.5, to reduce available
screenheight by 10 in calculation. I believe that Windows
is actually adding padding for the menu shadow.