[wxruby-users] how do i refresh a window
Mario Steele
mario at ruby-im.net
Thu Dec 4 01:13:04 EST 2008
Hello Omar,
On Wed, Dec 3, 2008 at 3:52 PM, Omar Hernandez <lists at ruby-forum.com> wrote:
> wel, I'm back with another newbee question.
Not a problem
the problem i'm having and that i coldn't find it on the internet is how
> to refresh a window, but someting more explained, maybe a tutorial or
> some doc?
>
> when i put muy window behind another one the contents is 'deleted',
> still there but not visible until i click again (for example in a
> textbox), in most cases.
>
> ok, first i'll explain what I'm Doing (wrong)
>
> first i call class Minimalapp
>
> Minumalapp calls a Frame class
>
> Within the frame class, on process initialize, I declare the menus, tool
> bars, panels, and a book. After the book i call both update() and
> refresh() (in that order), but when i run the program and put the window
> behind another one it doesn't update.
>
> the code (abstract) is this:
>
> -class Aframe< WX::Frame
> --def initialize
> ---menu bars and toolbars
> ---NoteBook
> ----panel
> ----textbox
> ----combobox
> ----etc
> ---update()
> ---refresh()
> --end
> -end
First off, update() and refresh() is only executed once, when you initialize
your Frame. It doesn't do any subsiquent repainting, as initialize is never
executed again in the lifetime of your Frame that you just created. To put
it into simpler terms, you do this:
myframe = Aframe.new
myframe will call the initialize method on Aframe to get everything setup.
Where your update() and refresh() are. After this point, initialize is
never called again, nor should it be, least your creating a new instance of
Aframe.
Secondly, the frame should be doing it's own updates and refreshes, unless
you are intercepting a evt_paint() on the frame itself. If your doing that,
then it will not repaint the frame itself, till you pass along the ok for
wxRuby to repaint the window itself.
Unless your doing some specialized graphics, you shouldn't need to intercept
the evt_paint(), and even then, if your doing specialized graphics, in a
certian area of your frame, I would strongly suggest that you create an
instance of panel, to do all of your drawing.
-class Minimalapp< wx::App
> -- on_init #calls Aframe
> -end
>
> #call minimallapp.main_loop
>
> any help for this newbee would be good.
> thanks
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>
If you could, post an absolute minimal example of the app replicating this
problem, full code, we can look at why this is occuring. Also, could you
please state if your on Mac, Windows, or Linux?
Thanks
--
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/20081204/3f10ef32/attachment-0001.html>
More information about the wxruby-users
mailing list