[Pharo-project] Trying to undeerstand Morphic subclasses and step/stepAt:
Hi, I want to build a morphic application (for algorithm animation) so I need to do something in the step method. I wanted to make it a subclass of SystemWindow (I'd actually prefer StandardWindow in Pharo but there doesn't appear to be an equivalent in Squeak). But when I do, the step method doesn't get called. (Nor does stepAt:) (And StandardWindow behaves the same.). But if I move it to MorphicModel step/stepAt: gets called, but I don't get any of that SystemWindow goodness. I've looked at the dispatch in Morph, and I don't see anything different in Worldstate>>runLocalStepMethodIn: but this stuff is very difficult to debug, because there's asynchronous stuff running behind the scenes. In particular, lastStepMessage value: now. lastStepMessage ifNotNil: [... is a little weird! Any pointers appreciated. Thanks ../Dave
Dave, when I create new morph classes, I usually subclass PasteUpMorph. If I need it in a window, I call #openInWindow on a new instance, though I find that first putting it in a ScrollPane makes for more useful behavior -usually. Regardless, the #step and #stepAt: calls work as expected when you use a PasteUpMorph subclass since you get the same behavior as you get from World. Lawson On 2/4/12 10:33 AM, Dave Mason wrote:
Hi,
I want to build a morphic application (for algorithm animation) so I need to do something in the step method.
I wanted to make it a subclass of SystemWindow (I'd actually prefer StandardWindow in Pharo but there doesn't appear to be an equivalent in Squeak). But when I do, the step method doesn't get called. (Nor does stepAt:) (And StandardWindow behaves the same.).
But if I move it to MorphicModel step/stepAt: gets called, but I don't get any of that SystemWindow goodness.
I've looked at the dispatch in Morph, and I don't see anything different in Worldstate>>runLocalStepMethodIn: but this stuff is very difficult to debug, because there's asynchronous stuff running behind the scenes. In particular, lastStepMessage value: now. lastStepMessage ifNotNil: [... is a little weird!
Any pointers appreciated.
Thanks ../Dave
Dave Mason-3 wrote
I wanted to make it a subclass of SystemWindow (I'd actually prefer StandardWindow in Pharo but there doesn't appear to be an equivalent in Squeak). But when I do, the step method doesn't get called. (Nor does stepAt:) (And StandardWindow behaves the same.).
To get your SystemWindow subclass to step, send #startStepping. I don't know if it's any better, but when I create my own morph-in-a-window, I usually don't subclass SystemWindow, but add my morph to a window using openInWindowLabelled: or addMorph:fullFrame:. I feel like I have a little more flexibility if I later want to use it not-in-a-window. HTH, Sean -- View this message in context: http://forum.world.st/Trying-to-undeerstand-Morphic-subclasses-and-step-step... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (3)
-
Dave Mason -
Lawson English -
Sean P. DeNigris