MenuPanel.st
changeset 4528 6ae7de57095c
parent 4527 38e526ae120b
child 4529 be0d73a19b37
--- a/MenuPanel.st	Fri Feb 28 15:38:19 2014 +0100
+++ b/MenuPanel.st	Fri Feb 28 15:51:32 2014 +0100
@@ -4110,21 +4110,20 @@
 hasKeyboardFocus:aBoolean
     "notification from the windowGroup that I got/lost the keyboard focus."
 
-    |focusView|
-
     self isPopUpView ifTrue:[
-	"/ not visible for popup menus
-	^ super hasKeyboardFocus:aBoolean
+        "/ not visible for popup menus
+        ^ super hasKeyboardFocus:aBoolean
     ].
 
     (aBoolean not and:[selection notNil]) ifTrue:[
-	hasImplicitGrap ~~ true ifTrue:[
-	    focusView := windowGroup focusView.
-
-	    focusView == self ifFalse:[
-		self selection:nil.
-	    ]
-	]
+        hasImplicitGrap ~~ true ifTrue:[
+            "if the selection does not have a submenu (so it is an 'executable' item),
+             keep it. Otherwise the action is not perform, if another view reauests the focus
+             e.g. in an accept action"
+            (windowGroup focusView ~~ self and:[selection hasSubmenu]) ifTrue:[
+                self selection:nil.
+            ]
+        ]
     ].
     super hasKeyboardFocus:aBoolean.
 !
@@ -8735,11 +8734,11 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.584 2014-02-28 14:38:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.585 2014-02-28 14:51:32 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.584 2014-02-28 14:38:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.585 2014-02-28 14:51:32 stefan Exp $'
 ! !