WindowEvent.st
changeset 3654 91f60b377f68
parent 3465 a14f06f3af91
child 3680 4c096f11e018
--- a/WindowEvent.st	Tue Jul 16 16:38:09 2002 +0200
+++ b/WindowEvent.st	Tue Jul 16 16:45:23 2002 +0200
@@ -655,6 +655,27 @@
     ^ false
 
     "Modified: 5.3.1997 / 11:27:40 / cg"
+!
+
+targetView
+    "return the view which will eventually handle the event;
+     for most events, this is the same as the view, for which the event was
+     originally generated.
+     Except, if an explicit focus has been assigned (i.e. tabbed into a component),
+     AND the event is a keyboard event. In this case, the targetView might be different.
+     Notice: this method might return nil, for synthetic (app-related) or display screen related
+     events"
+
+    |evView group focusView|
+
+    (evView := self view) notNil ifTrue:[
+        group := evView windowGroup.
+        group notNil ifTrue:[
+            focusView := group focusView.
+            focusView notNil ifTrue:[^ focusView].
+        ].
+    ].
+    ^ evView
 ! !
 
 !WindowEvent::InputEvent class methodsFor:'class initialization'!
@@ -1040,5 +1061,5 @@
 !WindowEvent class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.70 2001-08-16 10:15:48 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.71 2002-07-16 14:45:23 penk Exp $'
 ! !