[plt-scheme] [Mred] - syntax coloring in editor canvas

From: jack jack (jack4746 at hotmail.com)
Date: Thu Dec 7 10:03:01 EST 2006

Hi all,

i'm trying to make automatic syntax coloring of editor-canvas%'s content.

For testing,  i made changes manually, then entered text in the editor.

like this:
"entered text into editor"
>(define style-delta (make-object style-delta% 'change-weight 'bold))
>(send text1 change-style (send style-delta2 set-delta-foreground "navy"))
"entered text into editor"

That works but since yet i don't know how to change the style from an 
existing text.
i saw methods which changes colors but wasn't able to make them work at all, 
because the way i meant it is: using regexp-match to look for the keyword 
each time the user type text into the edit canvas (when i get an on-char 
event i call for the coloring function, on the line or the entire editor 
canvas content)

Since regexp returns a list containing the matched string(s), what do i need 
to do now?

Perhaps getting the start & end offset and change the color using a method 
which is called like change color from start offset until stop offset??? 
(how to?)

Or is there another, much easier, way doing it?

Thx in advance, helping me out,

Découvrez le blog Eragon sur Windows Live Spaces! 

Posted on the users mailing list.