On 28 July 2011 09:04, Lukas Renggli <renggli@gmail.com> wrote:
You need to give the morph the time to refresh. This regularly happens in the UI process, but probably not in your case because the system is busy with other things. Have a look at how OB implements the smooth scrolling of the panes:
ScrollBar>>animateValue: aNumber duration: anInteger     anInteger <= 0         ifTrue: [ self setValue: aNumber ]         ifFalse: [             | startTime start |             startTime := Time millisecondClockValue.             start := value roundTo: scrollDelta.             [ | delta |             [ (delta := Time millisecondClockValue - startTime) < anInteger ] whileTrue: [                 self setValue: (aNumber - start) * (delta / anInteger) + start.                 Processor yield ].                 self setValue: aNumber ]                     fork ]
Typically morphic animations should be implemented implemented using the built-in stepping mechanism (#wantsSteps, #step, ...), but that's not always possible.
I would say, that's the only way how morphs should animate themselves. Because if you do it otherwise (like in a loop), then you pausing a rest of processing, blocking UI etc and this is not good. A good example for morphs animation is bouncing atoms. But i'm not sure if it still residing in pharo images.
Lukas
On 28 July 2011 08:21, abara <barakat2@illinois.edu> wrote:
Hello,
I am having an issue where I need to refresh an object that is a subclass of RectangleMorph in a window. My object needs to travel across the screen at certain intervals.
A controller object tells this RectangleMorph object where wants it, and in turn the Rectangle object sets its new position with     self position: newX@ newY.
but the object does not show up. It does however take the exact time it should to travel, but it just doesn't display itself.
When I run the same program in debug, everything works fine, meaning I can see the object travel across the screen. Am I missing a method to refresh the object in real time? I have tried self changed, etc.
Thanks Barakat
-- View this message in context: http://forum.world.st/Morph-does-not-refresh-or-show-tp3700516p3700516.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Lukas Renggli www.lukas-renggli.ch
-- Best regards, Igor Stasenko AKA sig.