--- a/SimpleView.st Thu Feb 23 14:08:40 2017 +0100
+++ b/SimpleView.st Thu Feb 23 14:18:00 2017 +0100
@@ -11663,48 +11663,52 @@
another view (which is only available once visible),
use this to suspend the current process until the receiver is shown.
Caveat:
- we poll here for the view to be shown - we need a semaphore
- which is raised by the view in order to do it right."
-
- |wg n|
-
+ we poll here for the view to be shown - we need a semaphore
+ which is raised by the view in order to do it right."
+
+ |delay n|
+
+ delay := Delay forMilliseconds:50.
n := 0.
[self shown] whileFalse:[
- (device notNil and:[device isOpen not]) ifTrue:[^ self].
-
- "/ this was added to avoid a deadlock, when called from within
- "/ the event dispatch process (as when doing foo inspect there).
- n > (10 / 0.05) ifTrue:[
- 'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR.
- ^ self
- ].
- n := n + 1.
- Delay waitForMilliseconds:50.
- (wg := self windowGroup) notNil ifTrue:[
- wg processExposeEvents.
- ].
+ |wg|
+
+ (device notNil and:[device isOpen not]) ifTrue:[^ self].
+
+ "/ this was added to avoid a deadlock, when called from within
+ "/ the event dispatch process (as when doing foo inspect there).
+ n > (10 / 0.05) ifTrue:[
+ 'SimpleView [info]: View not visible after 10 seconds - will not wait any longer in waitUntilVisible' infoPrintCR.
+ ^ self
+ ].
+ n := n + 1.
+ delay wait.
+ (wg := self windowGroup) notNil ifTrue:[
+ wg processExposeEvents.
+ ].
].
"does not work (the view is in its opening phase,
when we attempt to draw a line - this gives an error, since
its internals are not yet correctly setup):
- |v|
-
- v := View new open.
- v displayLineFrom:0@0 to:50@50
+ |v|
+
+ v := View new open.
+ v displayLineFrom:0@0 to:50@50
does work (since we wait until the view has completely finished
its startup phase):
- |v|
-
- v := View new open.
- v waitUntilVisible.
- v displayLineFrom:0@0 to:50@50
+ |v|
+
+ v := View new open.
+ v waitUntilVisible.
+ v displayLineFrom:0@0 to:50@50
"
"Modified: / 08-08-2010 / 14:46:34 / cg"
+ "Modified: / 23-02-2017 / 14:17:10 / stefan"
! !
!SimpleView methodsFor:'testing'!