Forum: wxRuby parallel lines in a ScrolledWindow

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Svend Haugaard Sørensen (Guest)
on 2009-04-03 17:02
(Received via mailing list)
Attachment: ScrolledLines.rb (0 Bytes)
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?
Mario S. (Guest)
on 2009-04-05 12:43
(Received via mailing list)
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 <removed_email_address@domain.invalid>
Svend Haugaard Sørensen (Guest)
on 2009-04-05 16:32
(Received via mailing list)
> 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.
Alex F. (Guest)
on 2009-04-06 01:20
(Received via mailing list)
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
This topic is locked and can not be replied to.