On 15 November 2014 22:49, stepharo <stepharo@free.fr> wrote:
I get dizzy (may be time to go to sleep) but I wonder why do we need to check first the the window changed and after that it got closed? Especially since whenWindowChanged: presuppose that we have access to window. Am I missing something?
self whenWindowChanged: [ :w | w whenClosedDo: [ self clear ] ].
ComposableModel>>whenWindowChanged: aBlock window whenChangedDo: aBlock
WindowModel>>whenClosedDo: aBlock
isClosedHolder whenChangedDo: [:value | value ifTrue: [ aBlock value ] ]
i am lost with this code. i cannot understand what is it for? because by construction you start from building GUI representation of your model.. in this case - you create a controller - and create a window (or widget AKA presenter) connected to it if you wanna present your model differently, you just start from fresh controller/presenter pair but changing the presenter while keeping controller intact (hence whenWindowChanged:) ? in that case, if you really want that, you will need to wire all events from widget once you set it up.. and not just close events.. but all e.g.: self whenWindowChanged: [ :w | w whenClosedDo: [ ]. w whenKeyPressedDo: [..]. w whenInvalidUserDo: [..]. w whenSomethingWentWrongDo: [..]. w whateverHappensDo: [..]. ]. i don't know, maybe i don't see it clearly. just trying to understand. -- Best regards, Igor Stasenko.