From: kimura w. <ki...@us...> - 2005-04-13 17:20:57
|
Hi, The method NSApplication#beginSheet... is asynchronous. You not need to create a new thread. I wrote a testing app and it works fine. controller class: ---- class AppCtl < OSX::NSObject ib_outlet :window, :sheet def showSheet(sender) app = OSX::NSApplication.sharedApplication app.beginSheet(@sheet, :modalForWindow, @window, :modalDelegate, self, :didEndSelector, 'endSanmpleSheet', :contextInfo, nil) # wait... (1..3).each do |i| p i sleep 1 end app.endSheet(@sheet) end def endSanmpleSheet @sheet.orderOut(self) end end ---- NSApplication#endSheet does not close the sheet. We must call "orderOut" of the sheet in delegate method. http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html Tue, 12 Apr 2005 10:39:09 +0100, Jonathan Paisley wrote: >Below are some code fragments describing (1) and (2). > >(1) > > OSX::NSApplication.sharedApplication.beginSheet_...(@sheet,...) > > done = false > rl = OSX::NSApplication.sharedApplication.currentRunLoop > t = Thread.new do > rl.runMode_beforeDate(OSX::NSDefaultRunLoopMode, OSX::NSDate.date) >until done > end > > @doc = REXML::Document.new(big_xml_string) > ## code here to populate GUI from contents of @doc > > done = true > t.join > OSX::NSApplication.sharedApplication.endSheet(@sheet) > |