delphidelphi-7synedit

How to create a new Highlighter (SynEdit)


I'm relatively new on Delphi, but after installed SynEdit componnent, I can't create my own highlighter yet. I already generated the .pas with mine highlighting configs. I tried from all the ways I know. But I can't use the generated file to highlight. Can anyone help me?

I thank in advance...


Solution

  • Well, people. I already solved my problem. Actually it was so simple. To use the generated .PAS, just include it in the project and assign in the USES statemments. After that, you need to assign the custom highlighter to a SynComponent in RunTime. Like this:

    var
       HL : TSynSampleSyn;
    begin
       HL := TSynSampleSyn.Create(Self);
       SynEdit1.Highlighter := HL;
    end;
    

    After execute this block, the SynEdit will be ready for use.