Hi ! I'm trying to understand how regions are working in wxRuby. For now, I tried only to draw a rectangle and to move it. In order to do that, I use a region to tell wxRuby to refresh only the rectangle and not the whole screen. But no matter how I try, it always refreshs only a part of the rectangle. Can somebody tell me why ? I'm running wxRuby 2.0.1 on OSX, and wrote a script (attached to this post) as an example. Don't hesitate to tell me if my code looks bad and how to improve it, I'm a beginner in WxRuby as in Ruby. Thanks in advance.
on 2011-01-20 05:21
on 2011-01-22 21:12
Francis Toth wrote in post #976161: > Hi ! > > I'm trying to understand how regions are working in wxRuby. For now, I > tried only to draw a rectangle and to move it. In order to do that, I > use a region to tell wxRuby to refresh only the rectangle and not the > whole screen. But no matter how I try, it always refreshs only a part of > the rectangle. Can somebody tell me why ? > > I'm running wxRuby 2.0.1 on OSX, and wrote a script (attached to this > post) as an example. Don't hesitate to tell me if my code looks bad and > how to improve it, I'm a beginner in WxRuby as in Ruby. > > Thanks in advance. Finally, I worked it out ! I can't explain why, but it seems that wxRuby acts strangely when a region is cleared and redrawn in the same event. I decided to proceed with two different events : def refreshRectangle @frame.paint{|dc| clearRectangle(dc) } yield # move the rectangle @frame.paint{|dc| drawRectangle(dc) } end For those interested, I've put the new script in attachment. ++ Francis.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.