The SynEdit
control has an event OnGutterGetText
. I would like to use this to make the gutter only display every 10th line number (also line 1 and currently selected line). The same way that the Delphi (XE7) IDE works. How do I determine whether to show the line or not using this event?
Asked
Active
Viewed 777 times
-1

Jerry Dodge
- 26,858
- 31
- 155
- 327
-
1The event supplies you the line number. Surely that's all you need. – David Heffernan Oct 31 '15 at 21:11
-
@David Of course, what I'm asking is how to do the actual math to determine whether it should show. – Jerry Dodge Oct 31 '15 at 21:14
-
4`if (lineNum mod 10) = 0 then xxxx` – Graymatter Oct 31 '15 at 21:14
-
@Graymatter Thanks, I knew it was something like `mod` - I'm terrible with that side of math. – Jerry Dodge Oct 31 '15 at 21:15
1 Answers
4
The question transpires to be nothing to do with the edit control in reality. You simply want to know if a
is an exact multiple of b
. That is so if the remainder of a
divided by b
is zero. And the remainder operator in Delphi is mod
.
if a mod b = 0 then
Now, in your case you want
if LineNum mod 10 = 0 then
This assumes that LineNum
is one based. If it is zero based then you need
if (LineNum + 1) mod 10 = 0 then

David Heffernan
- 601,492
- 42
- 1,072
- 1,490