[Openmcl-devel] Using the COCOA BRIDGE (Denis Lorrain)

Denis Lorrain dlo_lorrain at yahoo.fr
Sun Jul 2 12:52:32 PDT 2017


Hello all,

Trying the same example, and others following in the same source tutorial:
- InterfaceBuilderWithCCLTutorial.pdf,
I have the same issue. LISP evaluations look fine and 100% as expected in CCL, but the example window(s) just don't pop up!

I have also tried to load Nibfiles as shown in examples found in
- Applications/ccl/examples/cocoa/nib-loading/HOWTO.html
All to the same effect: LISP evaluations are fine, objects are instanciated etc., but the windows are not displayed.

I'm running on Macintosh
- Mac OS 10.12.5
- CCL 1.11.1
- Xcode 8.3.3.

Thanks for any help.
--
Denis Lorrain
Site: http://denislorrain.org
Email: dlo at denislorrain.org________________________________
Date: Fri, 30 Jun 2017 13:37:14 -0400
From: Oscar Chappel <oachappel at yahoo.com>
To: openmcl-devel at clozure.com
Subject: [Openmcl-devel] Using the COCOA BRIDGE
Message-ID: <D4124740-6F82-45ED-8FA4-2C24DA255008 at yahoo.com>
Content-Type: text/plain; charset=us-ascii

Hello,

I have just implemented the show-red-window function described in the COCOA BRIDGE page.  When I execute the function I get an instance of the RED-VIEW class that I can inspect and describe.  I can not get this instance to display itself.  Here is the source code:

(in-package "CL-USER")

(require "COCOA")

(defclass red-view (ns:ns-view)
  ()
  (:metaclass ns:+ns-object))

(objc:defmethod (#/drawRect: :void) ((self red-view) (rect :<NSR>ect))
  (#/set (#/redColor ns:ns-color))
  (#_NSRectFill (#/bounds self)))

(defun show-red-window ()
  (ccl::with-autorelease-pool
      (let* ((rect (ns:make-ns-rect 0 0 300 300))
             (w (make-instance 'ns:ns-window
                  :with-content-rect rect
                  :style-mask (logior #$NSTitledWindowMask
                                      #$NSClosableWindowMask
                                      #$NSMiniaturizableWindowMask)
                  :backing #$NSBackingStoreBuffered
                  :defer t)))
        (#/setTitle: w #@"Red Window")
        (#/setContentView: w (#/autorelease (make-instance 'red-view)))
        (#/center w)
        (#/orderFront: w nil)
        (#/contentView w))))

The results of executing show-red-window and describing the resulting instance:

(setf win (show-red-window))
#<RED-VIEW <RedView: 0x6180001203c0> (#x6180001203C0)>
? win
#<RED-VIEW <RedView: 0x6180001203c0> (#x6180001203C0)>
? (describe win)
#<RED-VIEW <RedView: 0x6180001203c0> (#x6180001203C0)>
Class: #<OBJC:OBJC-CLASS RED-VIEW (#x60800005C020)>
Wrapper: #<CCL::CLASS-WRAPPER RED-VIEW #x302000EB514D>
Instance slots  •••  etc. etc. etc.  •••



More information about the Openmcl-devel mailing list