On 13 April 2010 15:19, Nick Brown <nickbrown(a)fastmail.fm> wrote:
Folks,
I'm running Pier from the
piercms.com one click image, and writing my own
structure and view subclasses, etc.
I'm wanting to produce an anchor which when clicked, will perform a command
and then switch to a different view.
I can do either one of those things, but seemingly not both. My assumption
was that I'd need to write something like the following, where #view: is
sent to the result of #command: ...
html anchor
goto: (
(self context command: MyCommandClass new) view: MyViewClass
);
with: 'click me'.
But I find that while this code takes me to the new view, the command is
never executed.
A view has its own nop-command, namely PRViewCommand. So just goto
MyCommandClass and make sure that MyCommandClass answers to your view
after performing the command. To do this override #doAnswer in your
command and set the context to your custom view.
MyCommandClass>>doAnswer
self answer: (self context view: MyViewClass)
Lukas
Is there an established way to do this? If not, I'd appreciate any ideas on
the best approach. It occurs to me that I could subclass the view command
and put my desired command behaviour in that.
Cheers,
Nick Brown
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
www.lukas-renggli.ch