The new block version of BusyCursor doesn''t work for me -- some actions in between the { braces } do not get carried out. To illustrate, I have taken the nothing.rbw sample app, and added a couple of lines to it, so the full code now reads: require ''wxruby'' include Wx class MyFrame < Wx::Frame def initialize(title) super(nil, -1, title) end end class NothingApp < Wx::App def on_init frame = MyFrame.new("Minimal wxRuby App") frame.show BusyCursor.new { message_box("This is a control sample", "About Controls") } end end a = NothingApp.new a.main_loop() ----------------------- However, the message_box line is never executed and the program seems to hang. Could somebody advise if I am doing something wrong? Thanks, David L.
David Legard wrote:> class NothingApp < Wx::App > def on_init > frame = MyFrame.new("Minimal wxRuby App") > frame.show > BusyCursor.new { > message_box("This is a control sample", "About Controls") > } > > end > end > ----------------------- > However, the message_box line is never executed and the program seems > to hang. Could somebody advise if I am doing something wrong?The sequence of this code is unusual, and that might be causing the problems. You might either: 1. do the BusyCursor and message_box *before* creating the frame, or 2. put the BusyCursor around both the frame.show and the message_box, or 3. move the BusyCursor and message_box inside the MyFrame class Beyond that, it seems odd to try to have the busy cursor displayed while a modal dialog (message_box) is showing. A more "fair" test might be to put up the busy cursor, and then just sleep for 5 seconds to simulate some slow non-UI operation taking place. Unfortunately, I don''t have time right now to actually test and research this. Hopefully these guesses will help, Kevin
I believe the correct method is BusyCursor.busy, not BusyCursor.new> The new block version of BusyCursor doesn''t work for me -- some > actions in between the { braces } do not get carried out. > > To illustrate, I have taken the nothing.rbw sample app, and added a > couple of lines to it, so the full code now reads: > > require ''wxruby'' > include Wx > > class MyFrame < Wx::Frame > def initialize(title) > super(nil, -1, title) > end > end > > class NothingApp < Wx::App > def on_init > frame = MyFrame.new("Minimal wxRuby App") > frame.show > BusyCursor.new { > message_box("This is a control sample", "About Controls") > } > > end > end > > a = NothingApp.new > a.main_loop() > > ----------------------- > However, the message_box line is never executed and the program seems > to hang. Could somebody advise if I am doing something wrong? > > Thanks, > > David L. > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > >--
Ah. That''s an error prone interface. BusyCursor.new should either do the right thing, or be hidden as private, or raise an exception if called incorrectly. Kevin Nick wrote:> I believe the correct method is BusyCursor.busy, not BusyCursor.new > > >>The new block version of BusyCursor doesn''t work for me -- some >>actions in between the { braces } do not get carried out. >> >>To illustrate, I have taken the nothing.rbw sample app, and added a >>couple of lines to it, so the full code now reads: >> >>require ''wxruby'' >>include Wx >> >>class MyFrame < Wx::Frame >> def initialize(title) >> super(nil, -1, title) >> end >>end >> >>class NothingApp < Wx::App >> def on_init >> frame = MyFrame.new("Minimal wxRuby App") >> frame.show >> BusyCursor.new { >> message_box("This is a control sample", "About Controls") >> } >> >> end >>end >> >>a = NothingApp.new >>a.main_loop() >> >>----------------------- >>However, the message_box line is never executed and the program seems >>to hang. Could somebody advise if I am doing something wrong? >> >>Thanks, >> >>David L. >>_______________________________________________ >>wxruby-users mailing list >>wxruby-users@rubyforge.org >>http://rubyforge.org/mailman/listinfo/wxruby-users >> >> > >
When I saw the post I thought the same thing. I''ll fix it after work cools off a little. Nick Kevin Smith wrote:> Ah. That''s an error prone interface. BusyCursor.new should either do the > right thing, or be hidden as private, or raise an exception if called > incorrectly. > > Kevin > > > > Nick wrote: > >>I believe the correct method is BusyCursor.busy, not BusyCursor.new >> >> >> >>>The new block version of BusyCursor doesn''t work for me -- some >>>actions in between the { braces } do not get carried out. >>> >>>To illustrate, I have taken the nothing.rbw sample app, and added a >>>couple of lines to it, so the full code now reads: >>> >>>require ''wxruby'' >>>include Wx >>> >>>class MyFrame < Wx::Frame >>> def initialize(title) >>> super(nil, -1, title) >>> end >>>end >>> >>>class NothingApp < Wx::App >>> def on_init >>> frame = MyFrame.new("Minimal wxRuby App") >>> frame.show >>> BusyCursor.new { >>> message_box("This is a control sample", "About Controls") >>> } >>> >>> end >>>end >>> >>>a = NothingApp.new >>>a.main_loop() >>> >>>----------------------- >>>However, the message_box line is never executed and the program seems >>>to hang. Could somebody advise if I am doing something wrong? >>> >>>Thanks, >>> >>>David L. >>>_______________________________________________ >>>wxruby-users mailing list >>>wxruby-users@rubyforge.org >>>http://rubyforge.org/mailman/listinfo/wxruby-users >>> >>> >> >> > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >