4

I'd like to access the errors on the active file (.pas). Now a days I can find it on the left side of the IDE, as you can see on image.

I found on OTA the interface IOTAModuleErrors, that seems to be what I want. But I didn't found it on BorlandIDEServices.QueryInterface or BorlandIDEServices.GetService. Someone knows how to access it ?

enter image description here

mjn
  • 36,362
  • 28
  • 176
  • 378
Rodrigo Farias Rezino
  • 2,687
  • 3
  • 33
  • 60

1 Answers1

4

I found it! It was much simpler than I thought, it's just a matter of casting the IOTAModule on the module to IOTAModuleErrors.

If you want a practical example you can check this project I use on the unit Source/FindUnit.OTAUtils.pas, on function GetErrorListFromActiveModule.

Sample:

function GetErrorsListFromActiveModule: TOTAErrors;
var
  ModuleServices: IOTAModuleServices;
  ModuleErrors: IOTAModuleErrors;
begin
  ModuleServices := BorlandIDEServices as IOTAModuleServices;
  Assert(Assigned(ModuleServices));
  ModuleErrors := ModuleServices.CurrentModule as IOTAModuleErrors;
  Result := ModuleErrors.GetErrors(ModuleServices.CurrentModule.FileName);
end;

Thank you

Rodrigo Farias Rezino
  • 2,687
  • 3
  • 33
  • 60