[Lazarus] ide.lpk 's project.pp and freepascal project.pp, same filename problem

FreeMan freeman35 at delphiturkiye.com
Mon Sep 23 12:17:15 CEST 2013


All voits goes to Mattias
Thank you so much Mattias, I'm so happy today. I added my codes

var LazProject: TLazProject;
       LazFile: TLazProjectFile;
       aDesigner : TComponentEditorDesigner;
.......
     LV.Items.Clear;
       LazProject:=LazarusIDE.ActiveProject;
        if LazProject<>nil then begin
           Self.Caption := Format('Project detail form [%s]', 
[LazProject.GetTitleOrName]);
          for i:=0 to LazProject.FileCount-1 do begin
            LazFile:=LazProject.Files[i];
            if LazFile.IsPartOfProject then begin
              if FilenameIsPascalUnit(LazFile.Filename)then begin
                L:=LV.Items.Add;
                L.Caption :=  ExtractFileName(LazFile.Filename);
//I was work for this two lines :)
aDesigner:=TComponentEditorDesigner(LazarusIDE.GetDesignerWithProjectFile(LazFile, 
True));
        L.Data := aDesigner.PropertyEditorHook.LookupRoot;
                S := ConcatPaths([ 
ExtractFileDir(LazFile.Filename),ExtractFileNameOnly(LazFile.Filename)]);
                if FileExists(S+'.lfm')then 
L.SubItems.Add(ExtractFileName(S+'.lfm'))
                else if FileExists(S+'.dfm')then 
L.SubItems.Add(ExtractFileName(S+'.dfm'))
                     else L.SubItems.Add('');
                L.SubItems.Add(ExtractFileDir(LazFile.Filename));
                L.Checked := Pos(LazFile.Filename, OpenedFiles)>0;
              end;
            end;
          end;
        end else begin
          L.Caption := 'Project name';
          L.SubItems.Add('');
          L.SubItems.Add('');
        end;

> To select a component use
>
> http://wiki.freepascal.org/Extending_the_IDE#Select_a_component_in_the_designer.2Fobject_inspector
>
> This will automatically set the correct LookupRoot.
>
>
> To get the form of a file see here:
> http://wiki.lazarus.freepascal.org/Extending_the_IDE#Get_unit.2C_designer.2C_form_of_a_file
>
> Mattias




More information about the Lazarus mailing list