Skip to main content
gamedev.net
🔒 Locked

Syntax Highlighting

Started by Programmer101 Feb 22, 2007 at 5:34 PM 8 replies 1.7k views
Original Post
Programmer101
Programmer101
I have a program that I'm making for webpage editing. How can I get the textbox to highlight the syntax in the html file? I'm using a forms based vc++ project and I have a rich text box.
SilentSno
SilentSno
I'm not sure if there is a windows function that will just highlight the syntax for you, but you'll need to parse the contents of the rich text edit and find symbols, keywords, etc that are specific to that kind of language, in this case HTML i presume.
Programmer101
Programmer101
Okay, so how would i change the font and color mid way through the text?
David Spoerri
David Spoerri
There was once a Control Library, that allowed you to plug in a Syntax Highlighting Control.

I've used this, years ago. But sadly I don't remember it, and can't tell you anything about it's current state. Good luck in Google.
BeanDog
BeanDog
Real-time syntax highlighting is a very complicated problem. See my earlier post in another thread on the topic.

I got mine working quite well, but it was a long, difficult process (weeks of hard work). I'd consider using ActiPro's controls if I were to do it all over again. I've never tried their syntax highlighting tool, but I use some of their .NET controls for other things and I've always been very impressed with their speed and polish.
jkleinecke
jkleinecke
I've heard of a .NET control called Fireball that does syntax highlighting.
-----------------------------------Indium Studios, Inc.
nemesisgeek
nemesisgeek
I made a RichEdit-based C++ syntax highlighter from scratch in a day and a half. It's not perfect, and it's a bit slow, but it works for my needs. I would recommend something better for a commercial project.

Screenshots are available in my IOTD post.

E-mail me if you're interested and I can send you a copy of the source.
hackerkey://v4sw7+8CHS$hw6+8ln6pr8O$ck4ma4+9u5Lw7VX$m0l5Ri8ONotepad++/e3+8t3b8AORTen7+9a17s0r4g8OP

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.