[wxruby-users] wxRuby dialog separate from main Ruby script execution

David Muir lists at ruby-forum.com
Thu Jan 15 05:29:18 EST 2009


Hi,

We have quite a large codebase in Ruby which uses Log4r to log errors,
warnings etc.  I have been trying to create a log window dialog using
wxRuby that can be popped up if a piece of code generates an error or
warning in one of our scripts.

E.g.
   GUI::LogWindow::show_dialog( ) do
     # Do something that will log messages.
   end

   def LogWindow::show_dialog( log, auto_popup = false, title = 'Log',
&block )
  log_window_thread = Thread.new do
    begin
      LogDialogApp.new( log, auto_popup, title ).main_loop( )
    rescue Exception => ex
      throw unless ( 'exit' == ex.message )
    end
  end

  yield if ( block_given? )
  log_window_thread.join( )
   end

My current problem is that when the wxRuby's main_loop is invoked no
Ruby code gets executed.  Is there any way around this?  Or is this a
limitation of using wxRuby?

Any suggestions appreciated.
Cheers,
David
-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list