« Return to Thread: Strugging with Commands

Strugging with Commands

by Keithy :: Rate this Message:

Reply to Author | View in Thread

I am struggling to write a command which edits a model, rather than the
command instance itself. I am trying to do it this way since the model
class and description may change whereas the command class does not.


PREditUser-asComponent

    | component |
     
    component := self model asComponent.
   
    ^ component addValidatedForm: (Array with: self saveButton with:
self cancelButton);
        onAnswer: [ :value |
            [ self execute ] on: Error do: [:err |  ^ component errors
add: err.                    ].
            value storeOnDB.
            self context: self answer  "<<<does not work" ];
        yourself.


The problem that I am having is that the standard onAnswer: for commands
is implemented by the containing Contents Widget somewhere else and I
cant see any way of overriding it.

Thanks in advance for any ideas

Keith
   

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

 « Return to Thread: Strugging with Commands

LightInTheBox - Buy quality products at wholesale price