Quitting a system/hierarchy browser opened with the ToolSet, fails
to inform the close to the model OB browser .
For example in the following code 1 doesnt get explored
| window |
window := ToolSet browse: Set selector: anyOne.
window model announcer observe: OBCloseRequest do:[:ann| 1 explore ].
Did anybody had this problem before? Or solved it already?
Fernando
_______________________________________________
Pharo-project mailing list
Pharo-...@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
>
> ---------- Forwarded message ----------
> From: Fernando olivero <oliv...@lu.unisi.ch>
> Date: Tue, Aug 18, 2009 at 12:01 PM
> Subject: [Pharo-project] System Window and OB model
> To: "Pharo-...@lists.gforge.inria.fr Development"
> <Pharo-...@lists.gforge.inria.fr>
>
>
> Quitting a system/hierarchy browser opened with the ToolSet, fails
> to inform the close to the model OB browser .
>
> For example in the following code 1 doesnt get explored
>
> | window |
> window := ToolSet browse: Set selector: anyOne.
> window model announcer observe: OBCloseRequest do:[:ann| 1
> explore ].
>
> Did anybody had this problem before? Or solved it already?
> Fernando
The reference to ToolSet is a red herring; we see the same behavior
with the following test case:
| window |
window := OBSystemBrowser open.
window model announcer observe: OBCloseRequest do:[:ann| 1 explore ].
However, this is expected, because OBCloseRequest is not an
Announcement, it's actually a Notification. It's raised by
OBBrowser>>close, which is not intended to be sent by the windowing
system. Instead, #close should be sent when we want to
programmatically close a browser. For example:
| browser |
browser := OBSystemBrowser new.
browser open.
(Delay forSeconds: 2) wait.
browser close
OBCloseRequest provides an opportunity to intercept the notification
and perform special handling if that's desired. For example:
| browser |
browser := OBSystemBrowser new.
browser open.
(Delay forSeconds: 2) wait.
[browser close]
on: OBCloseRequest
do:
[:request |
1 explore.
request pass]
If you want to intercept the closing of the browser by the user, try
implementing #windowIsClosing. This will get sent by Morphic when the
window is removed from the screen. See OBCodeBrowser>>windowIsClosing
as an example. NB. don't raise an OBCloseRequest from within
#windowIsClosing. That will result in infinite recursion.
Fernando, what are you attempting to do? Does this explanation help?
Colin