Recent

Author Topic: SynEdit Gutter numbering  (Read 2433 times)

jcmontherock

  • New Member
  • *
  • Posts: 17
SynEdit Gutter numbering
« on: November 04, 2017, 04:59:05 pm »
Hello,
I want to have my own numbering in SynEdit Gutter. I did not find the event like in SynEdit 2: OnGutterPaint. I cannot suppress or replace the default numbering. How can I do that ?

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: SynEdit Gutter numbering
« Reply #1 on: November 04, 2017, 07:07:44 pm »
synedit has a property named gutter opening up its leafs you will see a property named parts open it and you will find 5 parts usually the second one is named synGutterLineNumber that is the part that show the line numbers locate the class in your installation (unit syngutterlinenumber.pp) and study the code there create a custom class either inheriting from it or copying it verbatim and changing the code you want and register it with your synedit at runtime.
But first make sure that the current class can not cover your specifications since it has a number of properties (like the extremely badly named ShowOnlyLineNumbersMultiplesof)
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

jcmontherock

  • New Member
  • *
  • Posts: 17
Re: SynEdit Gutter numbering
« Reply #2 on: November 12, 2017, 02:29:58 pm »
Hello Tazz,
Now it works. First I tried to inherit class TSynGutteLineNumber without success, because overwrite of procedures does not work. As far as I can see, address of classes are saved into a list and there are launched from that list, so overwrite has no effect, strange method ! Afterward I included the source class in my application. That generates some problems of circular references with my Main Form and SynEdit class. Finally with declaring usage of main form unit into implementation paragraph of TSynGutterLine Number it works with changed TSynEditLineNumber Paint procedure. Thanks a lot for the leads you gave to me.
« Last Edit: November 12, 2017, 02:34:04 pm by jcmontherock »