added #findComponentAt: - recursive search for a named component
authorClaus Gittinger <cg@exept.de>
Tue, 22 Feb 2000 00:34:44 +0100
changeset 1357 facab5c393b9
parent 1356 e9bf01117cea
child 1358 3870ff2d5ce3
added #findComponentAt: - recursive search for a named component
WindowBuilder.st
--- a/WindowBuilder.st	Mon Feb 21 16:50:55 2000 +0100
+++ b/WindowBuilder.st	Tue Feb 22 00:34:44 2000 +0100
@@ -307,7 +307,7 @@
 
     "/ cg the following code looks in any application-
     "/ or master applications builder for the component.
-    "/ This as an effect, if a subcanvases builder is asked for
+    "/ This has an effect, if a subcanvases builder is asked for
     "/ a component, which is actually held by the real-apps builder
     "/ (in case they have different builders).
     "/ For now, this code is disabled, since I dont know what effect this
@@ -345,6 +345,25 @@
 
     componentCreationHook := something.!
 
+findComponentAt:name
+    "recursively search for a component identified by its name in myself
+     and all of my subApplications.
+    "
+
+    |comp app b|
+
+    (comp := self componentAt:name) notNil ifTrue:[^ comp].
+    self window allSubViewsDo:[:v |
+        ((app := v application) notNil 
+        and:[(b := app builder) notNil 
+        and:[b ~~ self
+        and:[(comp := b componentAt:name) notNil]]]) ifTrue:[
+            ^ comp
+        ]
+    ].
+    ^ nil
+!
+
 focusSequence 
     "return my focus sequence
     "
@@ -1239,5 +1258,5 @@
 !WindowBuilder class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.87 2000-02-17 14:58:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.88 2000-02-21 23:34:44 cg Exp $'
 ! !