I have some basic intro questions on Morphic. I'm digging through the
source code, and reading what I can find on the web, but it is quite a lot to take in. 1. Messages There seem to be at least 2 ways to handle messages with Morphic. The subclassing way, overriding methods such as *handlesMouseDown* and so on, and *on:send:to:* way. What are the differences between the two, and why would I prefer one over the other? 2. MorphicModel The MorphicModel class appears to be for morphs that implement the view side of MVC. However, I find the source rather confusing. What on earth is a *slotSelector*, for instance? And a method like *compileAccessForSlot* just leaves me baffled. What is this class for, and are there any simple examples of its use? 3. PasteUpMorph I know that the screen background is a PasteUpMorph, but I see them mentioned elsewhere from time to time. What exactly is a PasteUpMorph? Would I ever want to use one? Is there a simple example? Thanks in advance for your help. P.S. I just figure out how to make balloon text work. This stuff is cool! -- Jeffrey Straszheim http://straszheim.50megs.com _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Hi Jeffrey.
24 hours and no answer, so I'll have a crack at your questions. Jeffrey Straszheim wrote: > I have some basic intro questions on Morphic. I'm digging through the > source code, and reading what I can find on the web, but it is quite a > lot to take in. > > 1. Messages > > There seem to be at least 2 ways to handle messages with Morphic. The > subclassing way, overriding methods such as *handlesMouseDown* and so > on, and *on:send:to:* way. What are the differences between the two, > and why would I prefer one over the other? Unless you come across problems, either way is good. A quick look at the code shows that if you override methods, you'll be overriding the implementation used by on:send:to to implement message sending. It seems your implementation would run faster if you override the methods. You might want to use on:send:to if you want your event handling logic to be in another object. > > 2. MorphicModel > > The MorphicModel class appears to be for morphs that implement the > view side of MVC. However, I find the source rather confusing. What > on earth is a *slotSelector*, for instance? And a method like > *compileAccessForSlot* just leaves me baffled. What is this class > for, and are there any simple examples of its use? Welcome to Squeak. You might find a lot of the source quite confusing; there are a lot of ancient relics, failed experiments and red herrings in the image. Just try to understand only as much as you need; trying to understand more will leave you either confused or disgusted. Note firstly that MorphicModel is a superclass of a whole host of other classes - open up the hierarchy browser and see! I believe it represents to some degree the "model" of the model-view-controller paradigm that Morphic was written to be so blissfully unaware of. As with a slot - never heard of them, and the source code is pretty non-obvious. It messes with reflection, so it's probably dodgy code. > > 3. PasteUpMorph > > I know that the screen background is a PasteUpMorph, but I see them > mentioned elsewhere from time to time. What exactly is a > PasteUpMorph? Would I ever want to use one? Is there a simple example? The PasteUpMorph class in Squeak 3.9 has a pretty good description. Try this: PasteUpMorph newWorldTesting Often you'll find test methods on the class side. These can be useful for just playing with the code to see what it does. The BitBlt class tends to be pretty fascinating in this regard :-). Also, again, look at the inheritance hierarchy (the "hierarchy" button in the browser) and you'll see its the superclass of a bunch of other interesting looking classes. Don't forget to visit us on IRC at #squeak. It's often quiet for long periods, but people do come and go and we like newbies there. Cheers, Gulik _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Feb 15, 2008, at 9:55 , Michael van der Gulik wrote: >> There seem to be at least 2 ways to handle messages with Morphic. >> The >> subclassing way, overriding methods such as *handlesMouseDown* and so >> on, and *on:send:to:* way. What are the differences between the two, >> and why would I prefer one over the other? > > Unless you come across problems, either way is good. > > A quick look at the code shows that if you override methods, you'll be > overriding the implementation used by on:send:to to implement message > sending. It seems your implementation would run faster if you override > the methods. > > You might want to use on:send:to if you want your event handling logic > to be in another object. Typically you would only subclass if you create a new "kind" of morph. When you assemble a UI from existing morphs, you would use the event handlers. >> >> 2. MorphicModel >> >> The MorphicModel class appears to be for morphs that implement the >> view side of MVC. However, I find the source rather confusing. What >> on earth is a *slotSelector*, for instance? And a method like >> *compileAccessForSlot* just leaves me baffled. What is this class >> for, and are there any simple examples of its use? > > Welcome to Squeak. You might find a lot of the source quite confusing; > there are a lot of ancient relics, failed experiments and red herrings > in the image. Just try to understand only as much as you need; > trying to > understand more will leave you either confused or disgusted. > > Note firstly that MorphicModel is a superclass of a whole host of > other > classes - open up the hierarchy browser and see! I believe it > represents > to some degree the "model" of the model-view-controller paradigm that > Morphic was written to be so blissfully unaware of. > > As with a slot - never heard of them, and the source code is pretty > non-obvious. It messes with reflection, so it's probably dodgy code. Looks like the relict of a former UI builder. >> 3. PasteUpMorph >> >> I know that the screen background is a PasteUpMorph, but I see them >> mentioned elsewhere from time to time. What exactly is a >> PasteUpMorph? Would I ever want to use one? Is there a simple >> example? > > The PasteUpMorph class in Squeak 3.9 has a pretty good description. > Try > this: > > PasteUpMorph newWorldTesting PasteUpMorphs are typically only used in Etoys (except for the World of course). - Bert - > Often you'll find test methods on the class side. These can be useful > for just playing with the code to see what it does. The BitBlt class > tends to be pretty fascinating in this regard :-). > > Also, again, look at the inheritance hierarchy (the "hierarchy" button > in the browser) and you'll see its the superclass of a bunch of other > interesting looking classes. > > Don't forget to visit us on IRC at #squeak. It's often quiet for long > periods, but people do come and go and we like newbies there. > > Cheers, > Gulik > _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Bert Freudenberg wrote:
> PasteUpMorphs are typically only used in Etoys (except for the World > of course). Thanks for the replies. I'm planning on building a morph that acts as sort of a container for other morphs. That is, the user could drop morphs (of a limited set of classes) into this morph and then move them around within it, arranging them however they like. It seems to me that this is just what the PasteUpMorph is meant to do, but I'm not sure and am hoping someone can tell me if I'm on the right track. -- Jeffrey Straszheim http://straszheim.50megs.com _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |