From: Wolfgang K. <kit...@ka...> - 2010-02-16 19:12:49
|
I try to return an errorpointer as shown in http://rubycocoa.sourceforge.net/AssignValueToPointerArgument. Anyway, I get a runtime error when using "errorPtr.assign(error)": 2010-02-13 19:59:49.816 ErrorTest[4848:a0f] Contr#trigger: TypeError: can't convert OSX::NSError into Integer Looks like I have to somehow tell the ObjcPtr instance, what type of object I want to assign, perhaps when generating it. But I did not find any documentation about ObjcPtr.new. Best regards Kittekat P.S.: this is my test code.: require 'osx/cocoa' class Contr < OSX::NSObject include OSX ib_action :trigger def generateError(errorPtr) error = NSError.alloc.initWithDomain_code_userInfo( NSString.stringWithString('myDomainError'), 4711, nil) errorPtr.assign(error) end # generate_error def trigger(sender) errorPtr = ObjcPtr.new(1) generateError(errorPtr) a = NSAlert.alertWithError(errorPtr) a.runModal end # trigger end # Contr |