[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

user-pick-color



Arie -
  thanks for the bug report.  Here's the code user-pick-color, extended
to accept a position argument (actually, all the args have been turned
into keyword args).

     -andrew

-------------
(defun user-pick-color (&key (color *black-color*) 
                             (prompt "Pick a color")
                             (position #@(40 100)))
  "lets the user choose a color with the standard mac window"
  (with-cursor *arrow-cursor*
    (if *color-available*
        (with-rgb (rgb color)
          (with-pstrs ((pp prompt))
            (if (logbitp 8 (_GetColor :long position
                                      :ptr pp
                                      :ptr rgb
                                      :ptr rgb
                                      :word))
                (rgb-to-color rgb)
                (throw-cancel))))
        (if (y-or-n-dialog prompt
                           :yes-text "Black"
                           :no-text "White")
            *black-color*
            *white-color*))))