#REFACTORING by stefan
class: SimpleView
changed:
#detectViewAt:
#detectViewAt:ignoreInvisible:
rnow ignoreInvisible == true ignores invisible views
--- a/SimpleView.st Wed Mar 15 19:37:59 2017 +0100
+++ b/SimpleView.st Wed Mar 15 21:27:32 2017 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -8458,33 +8456,39 @@
"find the subView which contains aPoint - invisible components are ignored.
This is almost the same as #componentContainingX:y: (if that existed) "
- ^ self detectViewAt:aPoint ignoreInvisible:false
+ ^ self detectViewAt:aPoint ignoreInvisible:true
+
+ "Modified: / 15-03-2017 / 21:10:06 / stefan"
!
detectViewAt:aPoint ignoreInvisible:ignoreInvisible
"find the subView which contains aPoint - invisible components are ignored if
- the ignoreInvisible argument is false.
+ the ignoreInvisible argument is true.
This is almost the same as #componentContainingX:y: (if that existed) "
- |subViews|
-
- (subViews := self subViews) notNil ifTrue:[
- subViews do:[:v| |p|
- (ignoreInvisible or:[v shown]) ifTrue:[
- ( (aPoint x between:(v left) and:(v right))
- and:[aPoint y between:(v top) and:(v bottom)]
- ) ifTrue:[
- "/ found a subview - the point is there
- p := device translatePoint:aPoint fromView:self toView:v.
- ^ v detectViewAt:p ignoreInvisible:ignoreInvisible.
- ]
- ]
- ]
+ |subViews x y|
+
+ subViews := self subViews.
+ subViews notNil ifTrue:[
+ x := aPoint x.
+ y := aPoint y.
+ subViews do:[:v|
+ |p|
+
+ (ignoreInvisible not or:[v shown]) ifTrue:[
+ ((x between:v left and:v right) and:[y between:v top and:v bottom]) ifTrue:[
+ "/ found a subview - the point is there
+ p := device translatePoint:aPoint fromView:self toView:v.
+ ^ v detectViewAt:p ignoreInvisible:ignoreInvisible.
+ ]
+ ]
+ ]
].
"/ no subview - the point is here
^ self
- "Modified: / 10.10.2001 / 13:45:26 / cg"
+ "Modified: / 10-10-2001 / 13:45:26 / cg"
+ "Modified: / 15-03-2017 / 21:10:40 / stefan"
!
explicitExtent:aBoolean