CCL Cocoa 桥 "hello world" 不工作?
CCL Cocoa bridge "hello world" not working?
我正在尝试 运行 Clozure 为 CCL-Cocoa 桥提供的 "hello world" 脚本:
https://trac.clozure.com/ccl/wiki/CocoaBridge
Load the file containing these forms, evaluate (show-red-window), and you'll see a red window.
red-window.ccl
(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")
(#/setContentView: w (#/autorelease (make-instance 'red-view)))
(#/center w)
(#/orderFront: w nil)
(#/contentView w))))
但是当我 运行 ccl64
并输入
(load "red-window.ccl")
(show-red-window)
我刚刚在终端上得到这个输出:
#<RED-VIEW <RedView: 0x4cd530> (#x4CD530)>
似乎没有其他事情发生。
我错过了什么吗?我是 CL 和 Cocoa.
的新手
尝试
(gui:execute-in-gui #'(lambda () (show-red-window)))
带有红色 window 示例的页面最后更新于 10 年前。 One of the other examples from was last modified 13 天前包括 gui:execute-in-gui
。
我正在尝试 运行 Clozure 为 CCL-Cocoa 桥提供的 "hello world" 脚本:
https://trac.clozure.com/ccl/wiki/CocoaBridge
Load the file containing these forms, evaluate (show-red-window), and you'll see a red window.
red-window.ccl
(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")
(#/setContentView: w (#/autorelease (make-instance 'red-view)))
(#/center w)
(#/orderFront: w nil)
(#/contentView w))))
但是当我 运行 ccl64
并输入
(load "red-window.ccl")
(show-red-window)
我刚刚在终端上得到这个输出:
#<RED-VIEW <RedView: 0x4cd530> (#x4CD530)>
似乎没有其他事情发生。
我错过了什么吗?我是 CL 和 Cocoa.
的新手尝试
(gui:execute-in-gui #'(lambda () (show-red-window)))
带有红色 window 示例的页面最后更新于 10 年前。 One of the other examples from was last modified 13 天前包括 gui:execute-in-gui
。