"COMPUTER POWER TO THE PEOPLE! DOWN WITH CYBERCRUD!" - Theodor Nelson
My StuffLoveRespectAdmiration
My AmpsLinksArchives
|
Monday, October 10, 2005Re: Re: Dolphin's Command Framework
I got the following comment from Günther regarding this previous discussion:
Blaine, OK, I've been writing a little utility for myself to manage my Mp3s in Dolphin and here's the code that I use to add commands to a context menu (when you right-click on a model object in a tree view): setContextMenuFor: aModel The interesting bit of this method happens in #addCommand:description:. The command argument can be anything that understands the protocol #queryCommand: and #value. Symbol and MessageSend both do as well as my CommandMessageSend that I discussed earlier (since it is a subclass of MessageSend). Here's some examples of #actionItemDescriptions implementations that are called on the model in the above code: Mp3Respository>>actionItemDescriptions Mp3Root>>actionItemDescriptions I tried doing it through the ViewComposer and it can be done, but it's more trouble than it's worth. I decided to generate the code dynamically if I needed it. It's just as easy to add it through the code as it is to add it via the ViewComposer. I hope this explanation helps. I was trying out to see how I liked the model answering the things that it could do without knowing about the GUI. This was a cut at what it would feel like. Feel free to email me! =) I'll try to get on the IRC discussion more often. |
Comments
This is great stuff. I came upon MessageSend a few days ago and brooded on how to use it. This makes it perfectly clear and elegant.
One memento, however: Add those can... methods to the category must not strip or you will spend quite some time on trying to figure out why it does not work in deployed applications.
By Stefan Schmiedl, at 7:55 AM