How to animate scrolling?

Andreas Raab Andreas.Raab at gmx.de
Fri Jul 20 01:53:55 UTC 2001


Tim,

> Neat. I'll see what I can do with it. I don't suppose there
> is some sort of #replaceSteppingSelectorWith: that would
> sort of delegate the stepping for a while?

Ugh, not sure what you mean by this. What you can certainly do is something
like:

step
	self isInTheRightState ifTrue:[
		self stopSteppingSelector: #step.
		self startSteppingSelector: #anotherStep.
	].

Now, be warned that #step will be automatically triggered if a morph appears
in the world and #wantsSteps, so the above may lead to having both, #step
and #anotherStep be running at the same time. If you don't want this, *and*
if you can make sure you know where and when to step you can do something
like:

mouseDown: evt
	"We wish to start stepping #someStep but only if #someOtherStep is not
active"
	(self isSteppingSelector: #someOtherStep)
		ifFalse:[self startSteppingSelector: #someStep].

someStep
	"If we're in the right state delegate control to another step"
	self isInTheRightState ifTrue:[
		self stopSteppingSelector: #someStep.
		self startSteppingSelector: #someOtherStep.
	].

Also, you can have as many step methods as you wish - #step is just a simple
default that's more easily understood (I think ;-) than any of the above.
But nothing prevents you from doing stuff like:

mouseDown: evt
	"Start a bunch of stepping guys"
	self startSteppingSelector: #someStep.
	"But in five seconds start another stepper"
	self startStepping: #anotherStepper:
		at: Time millisecondsClockValue + 5000
		arguments: #(someStep)
		stepTime: 100. "msecs; overrides Morph>>#stepTime"

anotherStepper: aSelector
	"I've just started so stop the old stepper"
	self stopSteppingSelector: aSelector.
	self doSomethingReallyStrange.


Cheers,
  - Andreas





More information about the Squeak-dev mailing list