Is there a painless way to get a column ruler at the top of a TSynEdit, without having to do something like having multiple controls in a frame and forcing sideways scrolling to track?
Mailing lists / lazarus / 2013-10
Column ruler on TSynEdit
4 messages · 2 people ·
- MMark Morgan Lloyd 2
- MMartin 2
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Mark Morgan Lloyd wroteIs there a painless way to get a column ruler at the top of a TSynEdit, without having to do something like having multiple controls in a frame and forcing sideways scrolling to track?
You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide SourceSynEditor.pas)
using something like (this displays the procedure top hint)
FTopInfoDisplay: TSourceLazSynTopInfoView;That is reserving one line of the display for whatever you want it to be. It is some work though....
Or go the full 9 yards: Implement a top/bottom gutter (and submit it as patch).
In synedit, you have
FPaintArea: TLazSynSurfaceManager;
FPaintArea := TLazSynSurfaceManager.Create(Self);
FPaintArea.TextArea := FTextArea;
FPaintArea.LeftGutterArea := FLeftGutterArea;
FPaintArea.RightGutterArea := FRightGutterArea;
FPaintArea.DisplayView := FDisplayView;So that allows to add top/bottom gutter, and reserve the space needed (set correct boundaries for all other elements.
Note there must be no gaps between them. Gaps will not be painted at all.
Martin wrote 19 lines
Just a note, about optimizing painting. purely optional.
On some widgetset, invalidate always is the minimum enclosure rectangle for all invalidated parts.
So invalidating a bit of text at the visible bottom of the editor paints this bit of text (actually the full line)
But invalidating a bit of text at the visible bottom AND a bit of text (or gutter) on the top, will paint ALL lines inbetween too.
-------------
For that reason the overview gutter (which often invalidates on a different Y pos, than the rest of synEdit) creates a wincontrol of its own. This is a child to the SynEdit.
You can write a subclass of SynEdit, similar (but smaller than) to TIDESynEditor (in ide…
Martin wrote 35 lines
e.g. column 7 is on a punched card image.
