=== Top of the Swiki === Attachments ===

MethodForMakingMorphs

The talk about scrollbars made me realize that I never really use Squeak's scrollbars effectively, instead just dragging up and down lists. I've found the scrollbars in the Oberon system work very well for me, and I think they'd fit well into Squeak. Unfortunately, I find it very difficult to figure out where I should go to change behaviour in MVC. If someone can tell me what class/method(s) provide a good place to modify scrollbar behavior, that would be great.


I'd consider trying to implement your new scrollbars in Morphic. There are some examples there already (e.g., SliderMorph), and MorphicInterface is the wave of Squeak's future. Plus, I think you'll find it easier than working with MVC.

I usually start with an empty subclass of some generic morph like RectangleMorph, then add some instance variables and an initialization method (e.g. a "currentPosition" variable to store the slider's position), then a "drawOn:" method. At that point, I make an instance in a MorphWorld to see what it looks like, and possibly modify the drawOn: method. I then add mouse behavior by overriding the mouse handling protocol. Be sure to to override "handlesMouseDown:" to return true. Then add behavior for mouse down, move, and up.

It typically takes me under an hour to get a new interactive widget going, and most of that time is spent tweaking the appearance, which is rather enjoyable. It may take you longer the first time you do it, but by following the example of existing Morphs I suspect you'll have something going in under a day. -- JohnMaloney