Subject: | Menu issues |
The attached patch addresses two issues:
* Consider a menu with a cascade menu on the first position on a X11 system.
If posting the menu, then the cascade will automatically be opened, which
is strange and different from Windows behaviour and default
Tcl/Tk behaviour.
* Using the <Left> key on an opened cascade menu does not close the cascade. This is also different from Tcl/Tk.
The patch is not very well tested.
Regards,
Slaven
--- Tk/Menu.pm.orig 2004-04-29 19:19:33.000000000 +0200
+++ Tk/Menu.pm 2004-04-29 19:24:58.000000000 +0200
@@ -602,15 +602,14 @@ sub NextMenu
my $m2 = $menu->parent;
if ($m2->IsMenu)
{
+ $menu->activate('none');
+ $menu->GenerateMenuSelect;
+ $m2->SetFocus;
+
+ $m2->postcascade('none');
+
if ($m2->cget('-type') ne 'menubar')
{
- $menu->activate('none');
- $menu->GenerateMenuSelect;
- $m2->SetFocus;
- # This code unposts any posted submenu in the parent.
- my $tmp = $m2->index('active');
- $m2->activate('none');
- $m2->activate($tmp);
return;
}
}
@@ -796,7 +795,7 @@ sub FirstEntry
if ($menu->type($i) eq 'cascade')
{
my $cascade = $menu->entrycget($i,'-menu');
- if (defined $cascade)
+ if (0 && defined $cascade)
{
$menu->postcascade($i);
$cascade->FirstEntry;