Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to highlight a specific line in source editor using OpenToolsAPI

Is it possible to highlight a specific line in active editor window just like Delphi IDE does when highlighting compiler errors?

like image 477
Roman Yankovsky Avatar asked Mar 19 '14 06:03

Roman Yankovsky


1 Answers

If it's OK to just go to a certain line in the topmost editor then try this:

procedure GotoLine(LineNumber: Integer);
var
  EditorServices: IOTAEditorServices;
  Buffer: IOTAEditBuffer;
  Position: IOTAEditPosition;
begin
  if not Supports(BorlandIDEServices, IOTAEditorServices, EditorServices) then
    Exit;
  Buffer := EditorServices.TopBuffer;
  if not Assigned(Buffer) then
    Exit;
  Position := Buffer.EditPosition;
  if not Assigned(Position) then
    Exit;
  Position.GotoLine(LineNumber);
  Buffer.TopView.Paint;
end;
like image 159
Ondrej Kelle Avatar answered Sep 28 '22 21:09

Ondrej Kelle