wel, I''m back with another newbee question. 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 -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/.
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 > -endFirst 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>
Hello well the time came when i have to fix this problem, I''ll thank you for all your help. Mario Steele wrote:> ... the frame should be doing it''s own updates and refreshes, > unless > you are intercepting a evt_paint() on the frame itself. > ... > Unless your doing some specialized graphics, you shouldn''t need to > interceptI''m not doing specialized graphics, or I think so.> 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 > youI''m attaching a minimal example. The problems I found in my computer (windows)are: - The line is not drawn. - In report>person menu, If you select the combo, it errases a part of the grid (the part that was covered by the options) - In configuration> states menu, the TextCtrl has no borders. - When i minimize, restore, or cover the window with another window (the console window for example)the painting goes crazy, sometimes it dissapears, or the borders (when they had appeared) dissapear again.> please state if your on Mac, Windows, or Linux?We have tested it in two windows xp (media center and SP Professional) computers and is the same error. But in Mac it seems to be working fine. If you are trying to find the error, try anything you thing on the window (cover it, minimize, restore, etc.) so you can see what I mean Thanks for your help. Attachments: http://www.ruby-forum.com/attachment/3059/badpainting.rb -- Posted via http://www.ruby-forum.com/.
Omar Hernandez wrote:> > I''m attaching a minimal example. The problems I found in my computer > (windows)are: >Pages within Notebooks must be children of the Notebook. So everywhere you have Panel.new(self) you should have Panel.new(@book). With that changed, and adding some labels to the notebook tabs, things look to be working fine. I''ve only tested on OS X but I''d be pretty sure that having the wrong parent would explain problems like:> - The line is not drawn. > - In report>person menu, If you select the combo, it errases a part of > the grid (the part that was covered by the options) > - In configuration> states menu, the TextCtrl has no borders. > - When i minimize, restore, or cover the window with another window (the > console window for example)the painting goes crazy, sometimes it > dissapears, or the borders (when they had appeared) dissapear again. >hth a
Alex Fenton wrote:> Pages within Notebooks must be children of the Notebook. So everywhere > you have Panel.new(self) you should have Panel.new(@book). With that > changed, and adding some labels to the notebook tabs, things look to be > working fine. >yes, it''s working!! I guess it was a noob error. thank you very much -- Posted via http://www.ruby-forum.com/.