It actually acts exactly the same, just StandardWindow is hiding the complexity under the hood :) If you want the same: | ui | ui := MyUI new. World (or whatever morph) openModal: ui openWithSpec window. "you will arrive here at MyUI closing" ui value (idk which info you want). Another tip: Every Spec widget can be opened in a window (with openWithSpec as you know) but can also be opened in a dialog window (with openDialogWithSpec). In this mode, in opens with a ok button and a cancel button, and the support for cancelling properly, and the state of the ok action is partially implemented. All you need is to override MyUI>>initializeDialogWindow: aWindow (or something like this) " here I have to register the ok action " aWindow okAction: [ self ok ]. MyUI>>ok "Here is the action performed when ok is clicked. Return false to cancel the ok, and leave the window open" text accept. "Here some random test" (text text isEmpty or: [ text text = 'This field should not be empty' ]) ifTrue: [ text text: 'This field should not be empty'. ^ false ]. returnedValue contents: (MyWrapper with: text text with: dropList selectedItem) Then you can do | ui | ui := MyUI new. World openModal: ui openDialogWithSpec. ui returnedValue. "you will arrive here only once the dialog is validated and closed" I quickly wrote this example, but I think you can find more in the system (and I can provide you more examples as well) (Note that in the second part, you do not need your own ok, cancel buttons) Ben On Apr 30, 2013, at 9:12 AM, roberto.minelli@usi.ch wrote:
Hi,
As far as I understood, Spec is sort of asynchronous, let me explain.
I implemented my ComposableModel (i.e., MyWindow) as a window with a TextModel, a DropList model, and two buttons: ok and cancel.
The behavior I want to achieve is something that is easily doable with StandardWindow, something like
name := StandardWindow new textEntry: 'Please enter a name'.
Until the window stays open, the call does not return and once ok is pressed the result is stored in the 'name' variable.
Now with Spec I've something like 'MyWindow new openWithSpec', but the call returns immediately.
What is the best way to achieve such behavior? Thanks in advance.
Cheers, Roberto