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? _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
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 <shs at demosophia.net>> 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? > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20090405/179eccc1/attachment.html>
Svend Haugaard Sørensen
2009-Apr-05 12:11 UTC
[wxruby-users] parallel lines in a ScrolledWindow
> 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. >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.> hth, > > Mario > > 2009/4/3 Svend Haugaard S?rensen <shs at demosophia.net> > >> 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? >> >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > > -- > Mario Steele > http://www.trilake.net > http://www.ruby-im.net > http://rubyforge.org/projects/wxruby/ > http://rubyforge.org/projects/wxride/ > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Svend Haugaard S?rensen wrote:> 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?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