[Openmcl-devel] Uncle!

Ron Garret ron at awun.net
Fri Nov 2 16:09:18 PDT 2007

Poking through the easygui code I encountered this intriguing tidbit:

(defclass cocoa-drawing-view (ns:ns-view)

(define-useful-mouse-event-handling-routines cocoa-drawing-view)

Gotta love a language where you can define something called "define- 

So I decided to see what a cocoa-drawing-view did.  I tried this:

(add-subviews (make-instance 'window) (make-instance 'cocoa-drawing- 

which doesn't work because cocoa-drawing-views are ns:ns-views, not  
views.  Ten minutes of head-scratching and reverse-engineering later I  
came up with this:

(setf w (make-instance 'window))
(setf d (make-instance 'cocoa-drawing-view))
(dcc (#/addSubview: (cocoa-ref w) d))

which produced:

Calling addSubview: on (#<NS-WINDOW <NSWindow: 0xc4cd8f0> (#xC4CD8F0)>  
#<COCOA-DRAWING-VIEW <CocoaDrawingView: 0xc409d10> (#xC409D10)>)
 > Error: Objective-C runtime exception:
 >        *** -[NSWindow addSubview:]: unrecognized selector sent to  
instance 0xc4cd8f0
 > While executing: #<Anonymous Function #x3000411F1AAF>, in process  
 > Type :POP to abort, :R for a list of available restarts.
 > Type :? for other options.

at which point I decided it was time to ask for help.  Accordingly...




More information about the Openmcl-devel mailing list