How to highlight a specific line in source editor using OpenToolsAPI

笑着哭i 提交于 2019-12-21 17:19:13

问题


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


回答1:


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;


来源:https://stackoverflow.com/questions/22498243/how-to-highlight-a-specific-line-in-source-editor-using-opentoolsapi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!