NO

Author Topic: RichEdit Syntax Coloring  (Read 158 times)

Offline Grincheux

  • Member
  • *
  • Posts: 22
  • Never be pleased, always improve
    • Arachne
RichEdit Syntax Coloring
« on: January 07, 2020, 07:29:47 pm »
I know Scintilla (Notepad++, CodeBlocks...), Monaco (Microsoft), but that's all.
But they are in C++ !

I wonder how to do to syntax coloring with RichEdit. Is there an other solution rather than subclassing?
What do you use Mr Pelle in your IDE ?
-------------------------
Kenavo

Offline jj2007

  • Member
  • *
  • Posts: 511
Re: RichEdit Syntax Coloring
« Reply #1 on: January 08, 2020, 12:21:09 pm »
Since it's a RichEdit control, you can set the colours for each character via EM_SETCHARFORMAT. Works perfectly :)

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 1993
    • http://www.smorgasbordet.com
Re: RichEdit Syntax Coloring
« Reply #2 on: January 12, 2020, 06:18:03 pm »
What do you use Mr Pelle in your IDE ?
I use my own code.

With the Pelles C Setup you can optionally install source code of samples for the Add-In SDK.
The two samples CppFile (for the C++ language) and JsonFile (for the JSON language) demonstrates parsing of these two languages.
Other languages can be parsed in a similar way.

Basically, the samples parse one source line at the time, filling an array with positions where a new color is needed (and which color it is).
Once you have this array, printing this source line, or updating a RichEdit control, shouldn't be too complicated I think...
/Pelle

Offline Grincheux

  • Member
  • *
  • Posts: 22
  • Never be pleased, always improve
    • Arachne
Re: RichEdit Syntax Coloring
« Reply #3 on: January 12, 2020, 08:37:29 pm »
Thank You.


I will investigate. The syntax color is the only thing that it is missing, for me.
-------------------------
Kenavo