I think you want "break" instead of "return". You can't return from a block
(Proc).

-Gabriel


On Wed, Mar 30, 2011 at 7:53 AM, Martin Hawkins <martin.hawk...@gmail.com>wrote:

> From what I can read in the archives, this was raised about 18 months
> ago. Loosely following Matt's book, I've written the following code:
> def showOpenPanel( sender)
>    openPanel = NSOpenPanel.openPanel
>    openPanel.setCanChooseDirectories( false)
>
> openPanel.setShowsHiddenFiles(
> NSUserDefaults.standardUserDefaults.boolForKey( 'showHiddenFiles'))
>    openPanel.setAllowsMultipleSelection( true)
>    openPanel.beginSheetModalForWindow window, completionHandler:
> Proc.new{|result|
>      return if (result == NSCancelButton)
>      # throws error
>      }
> end
>
> The result is (on OS X 10.7, MacRuby 0.10), when the cancel button is
> pressed,
> uncaught Objective-C/C++ exception...
> terminate called after throwing an instance of
> 'RoxorReturnFromBlockException*'
> Program received signal:  “SIGABRT”.
> sharedlibrary apply-load-rules all
>
> Interestingly, on Lion,  the output then appears to loop:
> unable to read unknown load command 0x24
> unable to read unknown load command 0x26
> unable to read unknown load command 0x24
> unable to read unknown load command 0x26
> .
> .
> Do you need a new ticket?
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to