Hi, trying to display a progress dialog tied to a Frame using via... dlg = Wx::ProgressDialog.new("title", "task", max, self, Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) max and self both have valid values but everytime i try to use this i get... progress.rb:233:in `refresh'': wrong # of arguments(2 for 0) (ArgumentError) any ideas or an example of one that works? (running this on osx leopard) -- Posted via http://www.ruby-forum.com/.
John Griffiths wrote:> Hi, trying to display a progress dialog tied to a Frame using via... > > dlg = Wx::ProgressDialog.new("title", "task", max, self, > Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) > > max and self both have valid values but everytime i try to use this i > get... > > progress.rb:233:in `refresh'': wrong # of arguments(2 for 0) > (ArgumentError)Works fine for me with wxRuby 1.9.9 on Windows, and I''ve been using ProgressDialog on OS X recently and not had any problems. Are you in fact writing your own ProgressDialog subclass, and defining a method called ''refresh'' in it? wxRuby calls ''refresh'' upon Windows (with two arguments) when they need to be redrawn. This allows for custom handling in Ruby, but it will cause problems if you have a method with the same name that does something different. a
you might be on to something there, i''m trying to finish off someone else''s project so will have a hunt for anything with the same name. Cheers Alex -- Posted via http://www.ruby-forum.com/.
Excuse me for interrupting this, but how often is ''refresh'' on a window called, and what are it''s two arguments? On Tue, Jan 13, 2009 at 11:23 AM, Alex Fenton <alex at pressure.to> wrote:> John Griffiths wrote: > >> Hi, trying to display a progress dialog tied to a Frame using via... >> >> dlg = Wx::ProgressDialog.new("title", "task", max, self, >> Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) >> >> max and self both have valid values but everytime i try to use this i >> get... >> >> progress.rb:233:in `refresh'': wrong # of arguments(2 for 0) >> (ArgumentError) >> > Works fine for me with wxRuby 1.9.9 on Windows, and I''ve been using > ProgressDialog on OS X recently and not had any problems. > > Are you in fact writing your own ProgressDialog subclass, and defining a > method called ''refresh'' in it? wxRuby calls ''refresh'' upon Windows (with two > arguments) when they need to be redrawn. This allows for custom handling in > Ruby, but it will cause problems if you have a method with the same name > that does something different. > > > a > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- --Brains. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20090113/16525eae/attachment.html>
Timothy McDowell wrote:> Excuse me for interrupting this, but how often is ''refresh'' on a > window called, and what are it''s two arguments?It''s called when the window needs to be redrawn: http://wxruby.rubyforge.org/doc/window.html#Window_refresh I''m not 100% sure it''s the best way for it to be called from wxRuby into user ruby code. It''s something that makes sense the wxWidgets C++ way, but perhaps not the ruby way, where one would expect to stick to using evt_paint and/or evt_erase_background. In Ruby it can create surprising errors, as we''ve seen. It''s something that''s easy to change in the wrapping, any way. a
A refresh can''t always be truely tested, cause it falls in the domain of the native OS, and under several different conditions in which a refresh will occur. Mainly, a refresh will occur for part of a window, when the OS Detects that another window has covered up the window, and needs to repaint the region. A full refresh will also occur, if you minimize your app, and then restore it, as well as Maximizing and Restoring. Refreshes of controls occur on a control by control basis, meaning that if Control X is updated, but Control Y isn''t, Control X will get a refresh, while Control Y won''t. So, as you can see, there are many variables in which a refresh can occur, but it''s not always the same, and it''s never a "timed" matter. It''s an On-Demand deal. hth, Mario On Tue, Jan 13, 2009 at 4:25 PM, Timothy McDowell <tmcdowell at gmail.com>wrote:> Excuse me for interrupting this, but how often is ''refresh'' on a window > called, and what are it''s two arguments? > > > On Tue, Jan 13, 2009 at 11:23 AM, Alex Fenton <alex at pressure.to> wrote: > >> John Griffiths wrote: >> >>> Hi, trying to display a progress dialog tied to a Frame using via... >>> >>> dlg = Wx::ProgressDialog.new("title", "task", max, self, >>> Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) >>> >>> max and self both have valid values but everytime i try to use this i >>> get... >>> >>> progress.rb:233:in `refresh'': wrong # of arguments(2 for 0) >>> (ArgumentError) >>> >> Works fine for me with wxRuby 1.9.9 on Windows, and I''ve been using >> ProgressDialog on OS X recently and not had any problems. >> >> Are you in fact writing your own ProgressDialog subclass, and defining a >> method called ''refresh'' in it? wxRuby calls ''refresh'' upon Windows (with two >> arguments) when they need to be redrawn. This allows for custom handling in >> Ruby, but it will cause problems if you have a method with the same name >> that does something different. >> >> >> a >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > > -- > --Brains. > > _______________________________________________ > 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/20090114/27536ff3/attachment.html>
sorted, thanks guys... progress = Wx::ProgressDialog.new("Processing Images", "Processing Images...", 100, self, Wx::PD_CAN_ABORT|Wx::PD_APP_MODAL) works fine under windows and i can compile it to an exe with rubyscript2exe. -- Posted via http://www.ruby-forum.com/.