Ive got a question about codetools.
 
I have tried to add a method to the folowing code;
 
<<SNIP>>
unit Unit1;
 
{$mode objfpc}{$H+}
 
interface
 
type
  Ttest = class(Tobject)
  private
 
  public
    constructor Create;
  end;
 
implementation
 
constructor Ttest.Create;
begin
end;
 
end.
<<SNAP>>
 
My test code is the folowing;
 
<<SNIP>>
  CodeBuffer:=CodeToolBoss.LoadFile(FileName, false, false);
  
  ti.Kind := tkMethod;
  ti.Name := 'name';
  codetoolboss.CreatePublishedMethod(codebuffer, 'Ttest', 'NewMethodName', @ti);
 
  codebuffer.SaveToFile('test.pas');
<<SNAP>>
 
The problem however is that when I execute the code I get an exception message like: "unit not found: ObjPas".
 
Is there a way to prevent the codetool to parse all units in the uses clause and simply just stick to the unit provided? Or am I misinterpreting the errormessage in some way?
 
Darius

Reply via email to