[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setting text color in individual cells of sequence-dialog-item
- To: info-mcl@cambridge.apple.com
 
- Subject: Re: setting text color in individual cells of sequence-dialog-item
 
- From: lynch@ils.nwu.edu
 
- Date: Mon, 30 Nov 92 13:09:19 CST
 
>I need a way to set the color of the text displayed for individual 
>cells in a sequence-dialog-item (so that text in different cells may 
>be in different colors).  Any suggestions?
Basic idea:  Use part-color a-list with cell-number as indicator to
remember colors.
;;;;Untested code follows:
(defclass color-sequence (sequence-dialog-item) ())
(defmethod draw-cell-contents ((view color-sequence) cell)
  (with-fore-color (part-color view cell)
    (funcall (table-print-function view) (cell-contents view cell) view)))
;Note that you could also store and use a back-color for each cell by using
an ;indicator of (- (1+ cell)):
(defmethod draw-cell-contents :before ((view color-sequence) cell)
  (with-fore-color (part-color view (- (1+ cell)))
    (rlet ((rect :rect :topleft (cell-position view cell)
                       :bottomright (add-points (cell-position view cell)
                                                (cell-size view))))
      (#_PaintRect rect))))
"TANSTAAFL" Rich lynch@ils.nwu.edu