[Openmcl-devel] Subclassing NSWindow, receiving events

Duncan Rose duncan at robotcat.demon.co.uk
Fri Dec 19 03:56:45 PST 2003


I'm not sure what's wrong with the following (but obviously something 
is!). I'm playing with programmatically created windows and events in 
Cocoa from Lisp. Here's a copy of my listener session:

Welcome to OpenMCL Version (Alpha: Darwin) 0.14-031108!
? (ccl::def-objc-class newlisp-window ns-window)
#<A Mac Pointer #xF01C60>
? (ccl::define-objc-method ((:void :send-event e) newlisp-window)
(format t "** SEND-EVENT ~S~%" e))
;Compiler warnings :
;   Undeclared free variable CCL::SELF, in |-[NewlispWindow 
sendEvent:]|.
;   Unused lexical variable SELF, in |-[NewlispWindow sendEvent:]|.
|-[NewlispWindow sendEvent:]|
? (setf window (ccl::make-objc-instance 'newlisp-window))
#<A Mac Pointer #xF04070>
? (ccl::send window :order-front nil)
;Compiler warnings :
;   Undeclared free variable WINDOW, in an anonymous lambda form.
NIL
?

When I click on the window that appears, or move it around my terminal 
window (from which I started openmcl, and then did (require "COCOA") in 
this case) fills with:

2003-12-19 11:36:53.322 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.365 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.387 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.405 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.420 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.449 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.494 [3529] Error in event loop: Unbound variable: 
CCL::SELF
2003-12-19 11:36:53.549 [3529] Error in event loop: Unbound variable: 
CCL::SELF

which I guess is related to the compile warning from earlier.

I note (from objc-support.lisp) the following:

(define-objc-method ((:id :init-with-lisp-id (:unsigned lisp-id))
		     ns-lisp-exception)
   (setq self (send-super :init-with-name #@"lisp exception"
                          :reason #@"lisp exception"
                          :user-info (%null-ptr)))
   (setq lispid lisp-id)
   self)

Do I need to override one of the NSWindow init methods to set "self" up?
Sorry if this is documented somewhere, I haven't found anything on it 
yet (the tiny.lisp example comes close, but I can't see what I'm doing 
differently from it at a fundamental level - obviously something).

-Duncan




More information about the Openmcl-devel mailing list