[Openmcl-devel] Small contribution plus question

Arthur W Cater arthur.cater at ucd.ie
Wed Dec 17 08:56:32 PST 2008


In the code below, which principally defines USER-PICK-COLOR for Mac OS X,
why do I get a warning when compiling the objc:defmethod subform?
(Commenting out that part confirms it as the source of the warning.)

(in-package :easygui)

(let ((running nil))

  ; Provokes uncomprehended warning
  ; Undeclared free variable |-[NSColorPanel NSWindowWillCloseNotification]|
  (objc:defmethod (#/NSWindowWillCloseNotification :void)
                             ((self ns:ns-color-panel))
    (setf running nil)
    (#/stopModal (easygui::application-object)))
  
  (defun application-object nil
    (#/sharedApplication ns:ns-application))

  (defun user-pick-color (&key color (prompt "Pick a color") position)
    "POSITION argument is provided only for Digitool MCL compatibility, it is ignored"
    (declare (ignore position))
    (gui::with-autorelease-pool 
        (let* ((panel (#/sharedColorPanel ns:ns-color-panel))) ; find or create the NSColorPanel
          (#/setPickerMode: ns:ns-color-panel #$NSWheelModeColorPanel)
          (#/setTitle: panel prompt)
          (#/addObserver:selector:name:object:                 ; observe yourself close but
           (#/defaultCenter ns:ns-notification-center)         ; sadly confound OK & CANCEL
           panel
           (objc:\@selector #/NSWindowWillCloseNotification)
           "NSWindowWillCloseNotification"
           panel)
          (when color (#/setColor: panel color))
          (setf running t)
          (#/runModalForWindow: (easygui::application-object) panel)
          (do () ((not running)) (sleep 0.1))
          (#/removeObserver:name:object:                       ; prevent pileup
           (#/defaultCenter ns:ns-notification-center)
           panel
           "NSWindowWillCloseNotification"
           panel)
          (#/color panel)))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20081217/1af48787/attachment.htm>


More information about the Openmcl-devel mailing list