[MacRuby] #1148: Procs used for Cocoa callbacks are being given class objects instance of the instance of the class
MacRuby
ruby-noreply at macosforge.org
Thu Feb 3 09:58:44 PST 2011
#1148: Procs used for Cocoa callbacks are being given class objects instance of
the instance of the class
------------------------------------+---------------------------------------
Reporter: mrada@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
------------------------------------+---------------------------------------
When I try to use a proc for a notification callback instead of a method,
when the callback is made I am given the class object instead of the
instance of the object.
This example should work, but will not because when callback is called, it
will be given the NSDictionary class constant instead of an instance of an
NSDIctionary like I was supposed to get:
framework 'Cocoa'
callback = Proc.new { |notif| puts notif.userInfo.inspect }
workspace = NSWorkspace.sharedWorkspace
workspace.notificationCenter.addObserver callback,
selector:'call:',
name:NSWorkspaceDidLaunchApplicationNotification,
object:nil
workspace.launchAppWithBundleIdentifier 'com.apple.mail',
options:NSWorkspaceLaunchAsync,
additionalEventParamDescriptor:nil,
launchIdentifier:nil
NSRunLoop.currentRunLoop.runUntilDate( Time.now + 5 )
--
Ticket URL: <http://www.macruby.org/trac/ticket/1148>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list