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

Re: How to get the window hilite color?

>I'm trying to get the hilite color of a window. One would think
>this should be a pretty trivial task but I'm goin insane..
>However, if I use the inspector I can find my way though the hilite
>color which is different from the one returned by _getauxwin.
>Unfortunately, I'm not able to get the value returned by the inspector
>via rref:
> (rref 
>  (rref (wptr w) :cwindowrecord.port)
>  :cgrafport.grafvars)
> :grafvars.rgbhilitecolor)
>> Error: Illegal attempt to get a pointer to a :RGBCOLOR within a handle
>So, how can I access the hilite color of a window? Any ideas?

(defun hilite-rgb (window)
  (with-macptrs ((grafvars (pref (wptr window) :cwindowrecord.port.grafvars)))
    (values (href grafvars :grafvars.rgbHiliteColor.red)
            (href grafvars :grafvars.rgbHiliteColor.green)
            (href grafvars :grafvars.rgbHiliteColor.blue))))

; Some code to pop up a color picker with a window's hilight color.
(defparameter *w* (make-instance 'window :color-p t))
(user-pick-color :color (multiple-value-call 'make-color (hilite-rgb *w*)))