[mcclim-devel] How to change color of a text field

How can I change the color of the text displayed in a text field? Does the CLIM specification allow this? Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log

| How can I change the color of the text displayed in a text field? | Does the CLIM specification allow this? (make-pane 'text-field :foreground +red+ ....) Paul

"Paul Werkowski" <pw@snoopy.mv.com> writes:
| How can I change the color of the text displayed in a text field? | Does the CLIM specification allow this?
(make-pane 'text-field :foreground +red+ ....)
Thanks, but I forgot to mention that I would like to dynamically change the text color at runtime. Andy suggested the use of pane-foreground. But since there is no setf method for pane-foreground, I tried with medium-ink/medium-foreground, and a total redisplay with redisplay-frame-pane called on the gadget and :force-p t. This does not work. Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log

Try repaint-sheet rather than redisplay-frame-pane. On 4/19/05, Paolo Amoroso <amoroso@mclink.it> wrote:
"Paul Werkowski" <pw@snoopy.mv.com> writes:
| How can I change the color of the text displayed in a text field? | Does the CLIM specification allow this?
(make-pane 'text-field :foreground +red+ ....)
Thanks, but I forgot to mention that I would like to dynamically change the text color at runtime.
Andy suggested the use of pane-foreground. But since there is no setf method for pane-foreground, I tried with medium-ink/medium-foreground, and a total redisplay with redisplay-frame-pane called on the gadget and :force-p t. This does not work.
Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log _______________________________________________ mcclim-devel mailing list mcclim-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel

Andy Hefner <ahefner@gmail.com> writes:
Try repaint-sheet rather than redisplay-frame-pane.
I use code like this: (let ((gadget (find-pane-named *application-frame* 'my-text-field))) (setf (medium-foreground gadget) +blue+) (repaint-sheet gadget (sheet-region gadget)) (redisplay-frame-pane *application-frame* gadget :force-p t)) But I still get the default black color. The closest thing to changing color I have been able to get, playing with medium-ink/foreground and sheet-medium, is a blue text cursor. By the way, I call this code from the text field's activation callback: is this an issue? Poolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log

I've worked out how to do this, with luck it works for what you're trying to do. Here is an example: (defun color-text-field (ink) (let ((pane (find-pane-named *application-frame* 'text-field))) ;; The Goatee screen area keeps track of its own foreground color. (setf (goatee::foreground-ink (climi::area pane)) ink) ;; The cursor is still drawn in foreground ink of the sheet-medium. (setf (medium-foreground pane) ink) ;; Now force repaint of the sheet (repaint-sheet pane (sheet-region pane)))) (defun red-text-field (gadget) (color-text-field +red+)) (defun green-text-field (gadget) (color-text-field +green+)) (define-application-frame colored-text-editing () () (:panes (text-field :text-field) (red-button :push-button :activate-callback 'red-text-field :label "Redify") (green-button :push-button :activate-callback 'green-text-field :label "Greenicate")) (:layouts (default (vertically () text-field (horizontally () red-button green-button))))) On 4/19/05, Paolo Amoroso <amoroso@mclink.it> wrote:
How can I change the color of the text displayed in a text field? Does the CLIM specification allow this?
Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log _______________________________________________ mcclim-devel mailing list mcclim-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel

Andy Hefner <ahefner@gmail.com> writes:
I've worked out how to do this, with luck it works for what you're trying to do.
Here is an example:
(defun color-text-field (ink) [...]
It works fine, thank you very much. Paolo -- Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log
participants (3)
-
Andy Hefner
-
Paolo Amoroso
-
Paul Werkowski