Shifting canvas content

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Shifting canvas content

Esteban A. Maringolo-2
Hello,

    I'm playing with canvases, and i want to move all the content in a
canvas (or at least, give the impression of movement) in some direction,
like, let's say, in a piano roll.

    I didn't found any method to do this. And neither found examples of
playing with the canvas, can anybody give a clue?

    Thank you.

--
Esteban.


Reply | Threaded
Open this post in threaded view
|

Re: Shifting canvas content

Christopher J. Demers
"Esteban A. Maringolo" <[hidden email]> wrote in message
news:[hidden email]...
>     I'm playing with canvases, and i want to move all the content in a
> canvas (or at least, give the impression of movement) in some direction,
> like, let's say, in a piano roll.
>
>     I didn't found any method to do this. And neither found examples of
> playing with the canvas, can anybody give a clue?

There is a quick example bellow just to show one way to do it.  Consider
using a DoubleBufferedView and/or drawing on a bitmap and scrolling that for
something more complex.

===========
s := Shell show
canvas := s view canvas
canvas erase.
1 to: 20 do: [:count | canvas text: count displayString at: (count @ count)
* 15].
1 to: 30 do: [:count |
(Delay forMilliseconds: 500) wait.
canvas bitBlt: canvas rectangle: (Rectangle origin: 1@1 extent: s view
extent) to: 1 @ count rop: 13369376 "SRCCOPY".]
===========

Chris


Reply | Threaded
Open this post in threaded view
|

Re: Shifting canvas content

Esteban A. Maringolo-2
Hello Chris,

> There is a quick example bellow just to show one way to do it.  Consider
> using a DoubleBufferedView and/or drawing on a bitmap and scrolling that
for
> something more complex.

The example you gave me was what i was looking for.

Thank you.

--
Esteban.