On Tue, Jun 7, 2016 at 8:55 AM, Nicolai Hess <nicolaihess@gmail.com> wrote:


2016-06-07 8:21 GMT+02:00 Peter Uhnak <i.uhnak@gmail.com>:
Hi,

is it possible to return "synchronously" even if I have an asynchronous message?

For example:

SomeObject>>someMethod
�� �� �� �� ^ UIManager default chooseFrom: #(a b c)

When the above method is executed, it will open a popup and block the execution until I select something, then it will return the selection.

But if I instead have something like this

SomeObject>>otherMethod
�� �� �� �� |choice|
�� �� �� �� NewListModel new
�� �� �� �� �� �� �� �� items: #(a b c);
�� �� �� �� �� �� �� �� whenSelectedItemChanged: [ :item | choice := item ];
�� �� �� �� �� �� �� �� �� �� �� �� openDialogWithSpec.
�� �� �� �� �� �� �� �� �� �� �� �� choice.

Then it will open the window but it will immediately return nil.


With a spec window, you can try to open it modal
WindowModel>>#modalRelativeTo: aWindow


NewListModel new ... openDialogWithSpec modalRelativeTo: self currentWorld.

Thanks!

Peter