I am brand new to RubyCocoa (and Cocoa in general) and made a simple program that when you press a button, it calls an action in my ruby class.

My action takes some time to complete.

But it looks like while its executing that action, anything I send out an outlet doesn't get updated until the action is completed. In fact it looks like all other GUI activities with the application is blocked during the execution of the ruby action.

If I startAnimate an indeterminate NSProgressbar, the animation will stop while my action is executing.

Is there an easy way around this? I really want to be able to:

* Have my action be started by the button press

* Have the action start a progress bar animation or at least put up a string saying the action started.

* Run a long running process (ideally an backtick excution or pipe of another program

* Get the results and write them to an NSTextView

* Turn off the progress bar animation or update the text status message

I've got code that seems like it should do it, but what happens is if I use the progress bar, it never animates, or if I try to write a message at the start of the action and then another message at the end of the action, only the ending one is seen. It looks like all updates to the GUI happen after the action is complete.

Here's some sample code:

require 'osx/cocoa'

classMyController < OSX::NSObject
ib_outlets :textView, :statusText

def awakeFromNib
@statusText.setStringValue "Start"

puts "Top of scan"
@statusText.setStringValue "Foobar"
puts "After foobar"
sleep 3
@textView.setString("Some Text for the TextView")
puts "After textview"
@statusText.setStringValue "Ended"
puts "After Ended"


Thanks for any help!

Other than this (at least so far) I was able to do things really fast with RubyCocoa in one day. Its very impressive!


Robert J. Berger - Internet Bandwidth Development, LLC.
Voice: 408-882-4755 eFax: +1-408-490-2868