Questions on scrolling FormViews, etc.

Dan Ingalls DanI at wdi.disney.com
Tue Dec 8 04:24:17 UTC 1998


Mike -

>5. OK, already.  I should really be using Morphic.  Right?

Right.

>Any hints?  Can
>I get the performance I need to support smooth scrolling and "hand grabber"
>dragging?

Yes.

I'm busy with other things right now, but here's something to try --

Open a morphic project, and a workspace therein.  Also open some other recognizable junk that you like to look at.  You could always execute...

    HTTPSocket httpShowGif:
        'http://squeak.cs.uiuc.edu/Squeak2.0/midi/Squeakers.GIF'.

....in your workspace, which will put a morph with the squeakers' picture on your screen.

Paste the following into your worksapce, and execute it...

    World primaryHand attachMorph:
        (BackgroundMorph new addMorph: (ImageMorph new grabFromScreen))

This will prompt you to select some part of the screen, and you could grab the above image or anything else that you fancy.  When you're done selecting the image, you will have a small BackgroundMorph stuck to your "hand".  Find some appropriate part of the screen an lay it down simply by clicking there.  The BackgroundMorph has as its only job to will continually tile and scroll its content (think Sat morning cartoon background during a chase scene).  Use command click to get a halo, and use the yellow handle to change its size (the clipping rectangle).  This will give you some sense of the smooth scrolling performance available in morphic.  Note that this will run considerably faster if you override one method in BackgroundMorph...

    areasRemainingToFill: aRectangle
        ^ aRectangle areasOutside: self bounds

This tells the screen painter that it doesn't have to paint anything under that morph (it's normally cautious about transparent content).  Also things will run faster if this morph does not paritally obscure anything that is slow to draw (put it in a blank area to simplify things).

The scroll delta is wired into this example; use the red handle debug command to open an inspector on it and you can change the scroll delta.

Hope this helps.  You should be able to go from here to something useful.

	- Dan

PS:  Naturally this demo will perform quite differently in 8-, 16-, or 32-bit color.

Also note if you are new to morphic -- use cmd-click to get the halo, and note that repeated cmd-click will step you through any nested structure.





More information about the Squeak-dev mailing list