简体   繁体   中英

How to close a window with Spec in Pharo

I have a Spec window with several controls. When I click on the Ok button I want the window to be closed.

| m |
m := DynamicComposableModel new.
m instantiateModels: #(text TextModel ok OkToolbar).
m ok okAction: [ self close ].
m openWithSpecLayout: (SpecLayout composed
    newColumn: [ : c | c add: #text ; add: #ok height: 30 ];
    yourself).

I have tried sending delete and close, but none worked. How can I close the window?

you can do this:

| m |
m := DynamicComposableModel new.
m instantiateModels: #(text TextModel ok OkToolbar).
m ok okAction: [ m window close ].
m openWithSpecLayout: (SpecLayout composed
    newColumn: [ : c | c add: #text ; add: #ok height: 30 ];
    yourself).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM