Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-09

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

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

FreeMan

Hello,
All detail info at to this link. so no need write one more.

http://forum.lazarus.freepascal.org/index.php/topic,22040.0.html

I'm writeing component, it has a desigtime package(Martin say IDE add-on) I found TUnitInfo in project.pp but I can not use this IDE package's files. IDEintf has "TLazProjectFile" class. but I need to access to root component of file, so I can use
/ThePropertyEditorHook.LookupRoot := AComponent/; TUnitInfo = class(TLazProjectFile) this in project.pp file.
I can find this root component just in IDE.lpk. While lazarus IDE running there is no problem everything is work, building and installing my add-on.
But when try in command line :

make PREFIX=/opt clean all LCL_PLATFORM=qt bigide OPT="-dUSE_QT_45"

Lazarus maked bigide without any problem then this command line run,

./lazbuild --ws=qt --pcp=~/.lazarus --add-package --build-all --verbose --recursive --build-ide=

Compiling
/home/lazarus/components/sectreeview/sources/Manager/Project_Detail.pas Project_Detail.pas(11,3) Fatal: Can't find unit project used by Project_Detail
TExternalToolList.Run Exception:
/home/lazarus/components/sectreeview/sources/Manager/Project_Detail.pas(11,3) Fatal: Can't find unit project used by Project_Detail ERROR: tool reported error

this error was comming and stop. But IDE can run. I run IDE open Project_Detail.pas owner lpk compile and build, IDE restarting and my component is working.

I can't find Root component in IDEintf. I can find and use in IDE but I can NOT compile and install.
What will I do ?
Kubuntu 13.04
lazarus & freepascal last svn update
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130922/d71c625b/attachment.html>

Reply by email

FreeMan
to Mattias Gaertner

I need root component of file, that link has a screenshot, my component's code and form on there.
/ThePropertyEditorHook.LookupRoot := AComponent;///TUnitInfo.Component I need this

22-09-2013 19:12 tarihinde, Mattias Gaertner yazd?:

Show quoted text 18 lines
On Sun, 22 Sep 2013 11:38:08 +0300 FreeMan wrote: > Hello, > All detail info at to this link. so no need write one more. > > http://forum.lazarus.freepascal.org/index.php/topic,22040.0.html I see questions that you tried to access some internal IDE structures, but not why. What do you want to do? Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130922/978bc54a/attachment.html>

Reply by email

Mattias Gaertner
to FreeMan
I need root component of file, that link has a screenshot, my component's code and form on there. /ThePropertyEditorHook.LookupRoot := AComponent;///TUnitInfo.Component I need this

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

Reply by email

FreeMan
to Mattias Gaertner

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 LazProjectnil 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;
Show quoted text 11 lines

Reply by email

Mattias Gaertner
to FreeMan
Show quoted text 21 lines
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 LazProjectnil 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));

The GetDesignerWithProjectFile will load the form and open the designer if not yet done.

L.Data := aDesigner.PropertyEditorHook.LookupRoot;

aDesigner.PropertyEditorHook is GlobalDesignHook.

aDesigner.PropertyEditorHook.LookupRoot is the currently selected form/datamodule/whatever, which might not be the aDesigner component.

Use aDesigner.Form instead.

S := ConcatPaths([ ExtractFileDir(LazFile.Filename),ExtractFileNameOnly(LazFile.Filename)]);

Maybe you are searching for ChangeFileExt?

Keep in mind that LazFile.Filename might be 'unit1.pas' when the file was newly created and not yet saved.

Show quoted text 15 lines
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;

Mattias

Reply by email