Taking an action based on closing a window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Taking an action based on closing a window

Ted Bracht-2
Hi,

I've got a method that opens a window on a certain model and has to
take an action once the window is closed.

I've got something similar on a dialog window, which works fine
because of the modality of the dialog. But with normal views I can't
get it to work.

This is what I do with a dialog:

MyDialog showOn: myModel.
myModel someAspect isSomething: [ do something ].

As I said, in a normal view this doesn't work as the second line is
executed straight after opening the view, it doesn't wait till the
view is closed, therefore the myModel isn't updated yet with the user
input.

I tried capturing the state of the view by doing something like:

[ MyView showOn: myModel ] on: #viewClosed do: [ the usual checking ]
or
[ (MyView showOn: myModel) view ] on: #viewClosed do: [ the usual
checking ]

but the checking code is never called.

Anybody any suggestions?

Thanks

Ted


Reply | Threaded
Open this post in threaded view
|

Re: Taking an action based on closing a window

Ian Bartholomew
Ted,

How about something like (just using a ClassBrowserShell as an example)

s := ClassBrowserShell show.
s when: #viewClosed perform: [s selectedClass inspect]

or, IMHO, the better

s := ClassBrowserShell show.
s when: #viewClosed send: #modelUpdated: to: self with: s

You should find that the block or method is only evaluated when the
ClassBrowser is closed.

Is that what you wanted?

Ian


Reply | Threaded
Open this post in threaded view
|

Re: Taking an action based on closing a window

ted.bracht
Ian,

"Ian Bartholomew" <[hidden email]> wrote in message
news:RJaP6.98742$[hidden email]...

> Ted,
>
> How about something like (just using a ClassBrowserShell as an example)
>
> s := ClassBrowserShell show.
> s when: #viewClosed perform: [s selectedClass inspect]
>
> or, IMHO, the better
>
> s := ClassBrowserShell show.
> s when: #viewClosed send: #modelUpdated: to: self with: s
>
> You should find that the block or method is only evaluated when the
> ClassBrowser is closed.
>
> Is that what you wanted?

You're a star. Thanks alot.

>
> Ian
>
>
>
>
>

Ted