On Thu, 15 Feb 2007 15:51:49 +0200
"Graeme Geldenhuys" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I created a package that inserts a Toolbar at the top of the editor
> window. Currently containing one button (the first of many) that jump
> to certain parts of the code (Interface section, Implementation
> section, etc).
> 
> For the life of me, I can't get the following two functions to work.
> Can anybody give me a hand with this.  Calling those functions alway
> returns nil.  Attached is the package that uses the code.
> 
> FindImplementationUsesSection
> FindInitializationNode

The code only uses the cache - it does not trigger any parsing. And
because most IDE functions only parse the interface the cache does not
contain the implementation nodes.

Use this:

  CodeBuffer := SrcEditor.CodeToolsBuffer as TCodeBuffer;
  if CodeToolBoss.Explore(CodeBuffer,Tool,false,false) then begin
    case T of
      jmpIntf     : Node := Tool.FindInterfaceNode;
      jmpIntfUses : Node := Tool.FindMainUsesSection;
      jmpImpl     : Node := Tool.FindImplementationNode;
      jmpImplUses : Node := Tool.FindImplementationUsesSection;
      jmpInit     : Node := Tool.FindInitializationNode;
    end;
    if (Node <> nil) then
      Ok := JumpToNode(Tool, Node)
    else
      ShowMessage(Format(SErrCouldNotFind, [cJumpNames[T]]));
  end else
    LazarusIDE.DoJumpToCodeToolBossError;


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to