Lisp HUG Maillist Archive

Defining an objc selector

Hi

Is it possible to define a objc selector for an interface?

I tried something like this:

(capi:define-interface test-interface ()
....
)

(objc:define-objc-method ("testmethod" (:int))
     ((self test-interface))
   nil)


(let* ((interface (make-instance 'test-interface)))
           (win (objc:invoke (objc:invoke "NSApplication"  
"sharedApplication") "windowWithWindowNumber:" (capi:simple-pane- 
handle *i*))))
     (objc:invoke win "testmethod"))


But it doesn't work:
No method "testmethod" for object #<Pointer: OBJC:OBJC-OBJECT-POINTER  
= #x1699E160>


Any ideas?

Erik


Re: Defining an objc selector

On May 29, 2011, at 8:26 PM, Erik Ronström wrote:

> Is it possible to define a objc selector for an interface?

The intended way to use a capi interface with cocoa is to use capi:cocoa-view-pane and have it's init-function call your objc selector:

<http://www.lispworks.com/documentation/lw60/CAPRM/html/capiref-37.htm#pgfId-5114214>

Alternatively, you can create your own nib file, and use the cocoa interface to load that.

See the example at:

/Applications/LispWorks 6.0\ (64-bit)/Library/lib/6-0-0-0/examples/objc/area-calculator/

for how this is done.

hth,

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro@me.com






Updated at: 2020-12-10 08:37 UTC