[plt-scheme] Changing the style of all snips in an editor?

From: Matt Jadud (jadudm at gmail.com)
Date: Fri Nov 2 18:10:36 EDT 2007

Hi all,

How do I go about changing (say) the font face for all the snips in an editor?

Given the code:

(define f (new frame% (label "Woot") (min-width 200) (min-height 300)))
(define t (new text%))
(define ec (new editor-canvas% (parent f) (editor t)
                (style '(hide-vscroll hide-hscroll))))
(send f show #t)
(define delta (new style-delta%))
(send delta set-family 'script)
(define (change) (send t change-style delta 'start 'end #f))

I can type some text into my editor, invoke "change", and then any new
text entered is in script. However, I'm at a bit of a loss as to how I
encourage all of the snips in the editor to update their font family
(for example).

I can ask the editor for the first snip, and iterate through all of
them, but it isn't clear how I would update the style for each of
those snips. Or, perhaps that isn't the approved method.

I'm missing something in the documentation here, and have trolled
around the class hierarchy to think that something obvious might be
escaping me.

Many thanks,
Matt


Posted on the users mailing list.