[MacRuby-devel] NSOpenPanel error

Laurent Sansonetti lsansonetti at apple.com
Sun Jan 24 17:27:52 PST 2010


Hi Darrin,

I believe this error happens because you do not run within a properly  
initialized Cocoa session. In general, it is not possible to use Cocoa  
directly from macirb without calling at least  
NSApplication.sharedApplication and starting a run loop at the end.

HTH,
Laurent

On Jan 24, 2010, at 3:26 PM, Darrin Eden wrote:

> Hi,
>  The following is using a macruby build as of today. I'm not sure,  
> but I seem to be experiencing a debugger error while attempting to  
> work with a NSOpenPanel. The second time I create a NSOpenPanel no  
> error is reported.
>   Thoughts?
>
>  Thanks,
>    -- Darrin
>
>
> irb(main):001:0> framework 'Cocoa'
> => true
> irb(main):002:0> NSOpenPanel.openPanel
> Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>:  
> kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid  
> connection
> Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>:  
> kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch  
> errors as they are logged.
> Sun Jan 24 15:17:49 imac.local macruby[13149] <Error>:  
> kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid  
> connection
> => #<NSOpenPanel:0x200274540>
> irb(main):003:0> NSOpenPanel.openPanel
> => #<NSOpenPanel:0x2002fa220>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list