ismodal moved up;
authorca
Fri, 27 Oct 2000 15:18:10 +0200
changeset 3347 e7b8350d6525
parent 3346 bf96cfb1f6ac
child 3348 7049f1baa6de
ismodal moved up; moved focus & grabHandling from ModalBox (in case some other view is opened modal)
TopView.st
--- a/TopView.st	Fri Oct 27 15:17:30 2000 +0200
+++ b/TopView.st	Fri Oct 27 15:18:10 2000 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libview' }"
+
 View subclass:#TopView
 	instanceVariableNames:'type iconified'
 	classVariableNames:'TakeFocusWhenMapped'
@@ -367,6 +369,12 @@
     "Modified: 4.4.1997 / 14:44:39 / cg"
 !
 
+isModal
+    "return true, if the receiver has been opened modal"
+
+    windowGroup isNil ifTrue:[^ false].
+    ^ windowGroup isModal!
+
 isPopUpView
     "return true, since I want to come up without decoration 
      and popUp to top immediately."
@@ -610,18 +618,31 @@
     "/
     self masterSlaveMessage:#remap inGroup:windowGroup.
 
-    "
-     ask for the focus - this avoids having to click on the
-     view with WM's which need an explicit click.
-     Q: is this a good idea ?
-    "
-    TakeFocusWhenMapped == true ifTrue:[
+    self isModal ifTrue:[
+        "take it away from any popup menu possibly still active"
+
+        self forceUngrabKeyboard.
+        self forceUngrabPointer.
+        "
+         get the focus
+        "
         self getKeyboardFocus.
+        self enableEnterLeaveEvents
+    ] ifFalse:[
+        "
+         ask for the focus - this avoids having to click on the
+         view with WM's which need an explicit click.
+         Q: is this a good idea ?
+        "
+        TakeFocusWhenMapped == true ifTrue:[
+            self getKeyboardFocus.
+        ]
     ]
 
+
+
     "Modified: / 10.9.1998 / 22:02:52 / cg"
-    "Modified: 30.5.1996 / 09:37:22 / cg"
-!
+    "Modified: 30.5.1996 / 09:37:22 / cg"!
 
 masterSlaveMessage:aSelector inGroup:aWindowGroup
     "send aSelector to partners and/or slaves.
@@ -671,5 +692,5 @@
 !TopView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.66 2000-01-25 10:58:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.67 2000-10-27 13:18:10 ca Exp $'
 ! !