Parallel lines in a ScrolledWindow

Hey.

I am trying to figure out how access all the
client area in an evt_paint in a scrolled window.

I have made a little demo program, where I try
to draw 2 parallel lines, and when scrolling
the lines, they should stay parallel and the
distance between them should increse.

But since only the ‘new’ area gets redrawen
the lines don’t become parallel.

How can I fix it so that they becomes parallel?

Hello Svend,

You may want to take a look at the wxScrolledWindow code in BigDemo.rb,
in
the samples directory. You should be able to find code in there, that
offers references points in the client area, where to keep track of
where
the user draws lines, and you can start to scroll through things.

You should be able to see in the code, where the drawing of the user
input
with the mouse (MouseEvent), to see where it grabs the client position,
and
normalizes it to where you are in the actual view of the client view,
compared to the Canvas.

hth,

Mario

2009/4/3 Svend Haugaard Sørensen [email protected]

normalizes it to where you are in the actual view of the client view,
compared to the Canvas.

Thank your for the reply, unfortunately your have totally misunderstood
the question.

Simple conversation of user input coordinates to window coordinates
I have solve long ago.

Try to run my program and your and your will see that the parallel lines
gets tilted when your scrool the window.
I am tying to update the hole client area at once.

Svend Haugaard Sørensen wrote:

But since only the ‘new’ area gets redrawen
the lines don’t become parallel.

How can I fix it so that they becomes parallel?

I think you want something like (untested)

evt_scroll { refresh }

Calling refresh() tells wxRuby that the whole window is invalidated and
needs to be redrawn, not just the parts of the window that have newly
been scrolled into view.

By the way, it’s useful to mention what OS you’re using. For example, I
don’t see what you describe when I run your program on OS X- it works
the way I think you want it to work - probably because different OSes
handle drawing and buffering slightly differently.

alex