Recent

Author Topic: How to enable colored hilighting  (Read 5023 times)

simone

  • Hero Member
  • *****
  • Posts: 573
How to enable colored hilighting
« on: February 06, 2017, 08:25:27 pm »
Dear All, I'm using a SynEdit component with Highlighter proporti setted to a TSynFreePascalSyn component. Highlighter works, but without coloring keywords and other syntax elements. How can I enable coloring, like in Lazarus editor? I apologize if this feature is documented and I was unable to find it... Thanks in advance.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: How to enable colored hilighting
« Reply #1 on: February 06, 2017, 08:42:29 pm »
Have a look at the wiki http://wiki.lazarus.freepascal.org/SynEdit_Highlighter.

You can set the appearance of the different highlighter attributes (for example KeyAttri):
Code: Pascal  [Select][+][-]
  1. yourhighlighter.KeyAttri.Background := clRead;
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: How to enable colored hilighting
« Reply #2 on: February 06, 2017, 09:07:21 pm »
SynEdit has more than one source of highlighting.

The HL does the basic grammar.

Then there are Markup modules for:
matching brackets,
begin-end pair,
all same words as word at caret

Some of them have properties on the SynEdit, other can only be set by code. TFooMarkup(SynEdit.MarkupByClass[TFooMarkup]).MarkupInfo.*Color where TFooMarkup is one of the markup classes, you can find looking through the SynEdit code (look at the uses part)

So it depends what you mean with "keywords and other elements"

keywords are: for do if then else begin class ......, They should by default be bold (but see previous post, that can be changed)


simone

  • Hero Member
  • *****
  • Posts: 573
Re: How to enable colored hilighting
« Reply #3 on: February 06, 2017, 11:03:27 pm »
In my application I need an editor that supports different languages, with color highlight syntax feature. I thought that every built-in highlighter had default settings to color, for example: keywords, comment, quoted text, etc. If not, I must to set this feauture by code or using the object inspector, for every different laguages. Indeed, as so far I understand, defalt settings concern only bold/italic style of words in the code, not the colors... It's right?
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9869
  • Debugger - SynEdit - and more
    • wiki
Re: How to enable colored hilighting
« Reply #4 on: February 06, 2017, 11:39:09 pm »
You can change the settings in Object Inspector. See Pascals post.

I dont know what the defaults are for each HL, but I looked at the source and for pas, they seem only bold/italic.
Other HL, may have defaults with color, or not... You have to test.

simone

  • Hero Member
  • *****
  • Posts: 573
Re: How to enable colored hilighting
« Reply #5 on: February 07, 2017, 10:45:59 am »
Thanks for help. I will try!
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

 

TinyPortal © 2005-2018