SimpleView.st
changeset 5548 4bc2de4d03f9
parent 5547 07869f48d479
child 5551 7574a9f6f7a3
--- a/SimpleView.st	Tue Feb 02 10:55:05 2010 +0100
+++ b/SimpleView.st	Wed Feb 03 00:15:56 2010 +0100
@@ -5191,6 +5191,23 @@
     "Modified: 12.2.1997 / 12:23:38 / cg"
 !
 
+allVisibleSubViewsDetect:aBlock ifNone:exceptionBlock
+    "find a visible subview for which aBlock returns true (recursively)"
+
+    subViews notNil ifTrue:[
+        subViews do:[:aSubview |
+            |v|
+
+            aSubview shown ifTrue:[
+                (aBlock value:aSubview) ifTrue:[ ^ aSubview ].
+                v := aSubview allVisibleSubViewsDetect:aBlock ifNone:nil.
+                v notNil ifTrue:[^ v].
+            ].
+        ]
+    ].
+    ^ exceptionBlock value.
+!
+
 changeSequenceOrderFor:aSubViewOrComponent to:anIndex
     "change a subview's position in the subviews collection.
      Usually, this only affects the order of components in a panelView,
@@ -6426,15 +6443,17 @@
     |viewInSubView|
 
     self subviewsInFocusOrder do:[:aSubView|
-	(aSubView canTab
-	and:[aSubView enabled
-	and:[aCondition value:aSubView]]) ifTrue:[
-	    ^ aSubView
-	].
-
-	(viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[
-	    ^ viewInSubView
-	]
+        aSubView shown ifTrue:[
+            (aSubView canTab
+            and:[aSubView enabled
+            and:[aCondition value:aSubView]]) ifTrue:[
+                ^ aSubView
+            ].
+
+            (viewInSubView := aSubView focusNextForWhich:aCondition) notNil ifTrue:[
+                ^ viewInSubView
+            ]
+        ]
     ].
     ^ nil
 !
@@ -10577,11 +10596,11 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.655 2010-02-02 09:55:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.656 2010-02-02 23:15:56 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.655 2010-02-02 09:55:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.656 2010-02-02 23:15:56 cg Exp $'
 ! !
 
 SimpleView initialize!