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)
on 2009-01-13 18:53
on 2009-01-13 19:51
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
on 2009-01-13 22:16
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
on 2009-01-14 07:31
Excuse me for interrupting this, but how often is 'refresh' on a window called, and what are it's two arguments?
on 2009-01-14 09:12
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 2009-01-14 09:39
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
on 2009-01-15 14:32
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.
on 2009-01-15 14:33
and then update the dialog (for 5%, 10%, etc...) progress.update(count, "Processing: "+row.to_s)