![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 11
Rep Power: 0
![]() |
Syntax coloring
Hi! Is there a tutorial on syntax coloring available?
|
|
|
|
|
|
#2 |
|
Professional Programmer
|
what do you mean? what program are you using? syntax coloring is determined by the program. Vim has a bunch of .vim files that determine what gets what color, and I'm sure other programs have similar methods
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 5
![]() |
If it is for MS Visual Studio I posted a "how to" on adding your own "words" for syntax highlighting for C++ but I am sure the same would apply to Visual Basic just different directory... worth a look. Just cant remember where i posted it :/
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005! |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Sep 2004
Location: JHB , South Africa
Posts: 79
Rep Power: 5
![]() |
__________________
Ravilj's OpenGL Terrain aka WinTerrain Last Updated: 17/01/2005! |
|
|
|
|
|
#5 |
|
Professional Programmer
|
ah Visual Studio, i always forget to look at what forum we're in..my bad..
![]() |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Jan 2005
Posts: 11
Rep Power: 0
![]() |
What I mean is: I am making a GUI editor for a programming language, that's why I need to know how to make a RichText editor color some keywords, like "print" or so.
|
|
|
|
|
|
#7 |
|
Expert Programmer
|
Syntax Colouring
OK I know what you're trying to do.
I made a similar thing for writing VBScripts for windows, because I was annoyed that nothing would do it (until Notepad2 came along!) The way I did it was to have a Rich Text Control in which the user types stuff. When the line that the I-bar is on is changed (i.e. up,down,return is pressed or the user goes beyond the end of the line) that line ONLY is coloured - if you try to re-colour everything every time a key is pressed, it goes really slowly. Funtions like getcurrentline and getlinecharstart aren't hard to write, you just have to be careful if the word starts at +1 or -1 etc. Iterate through the edited line, searching for keywords, capitalising and colouring them appropriately. Design your functions carefully - remember, if you wanted to highlight "Or" and capitalize it, you could end up with "FOr" "FOrm" etc. If you are familiar with the rich text format (a markup language like HTML) you can search for and change the appropriate tokens to apply colour. Otherwise, the slightly slower method is to set SelStart and SelLength appropriately along with the SelColor attribute. It worked fine for me, as the files I wanted to write with it were going to be no more than a page long, however if you want to write a full-blown IDE then the rich text box control will struggle - you'll probably need to write your own. Then you can go on to autocomplete, parameter info tooltips etc... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|