[Lazarus] Buttons in frames

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Feb 3 16:38:38 CET 2013


On Sun, 03 Feb 2013 15:14:45 +0000
Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:

>[...]
> SourceEditorManager.SomethingModified
> 
> Source Editor:
>    /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas 
> Component=True
> 
> and the IDE now doesn't open a duplicate tab/pane when the compiler 
> complains about the error. I think what's happened is that my action of 
> restarting the IDE with the file closed has sorted things out. In other 
> words this lot is still approximately valid...
> 
> >> Project units:
> >> ./../inifiles/trunk/dbconfigcode.pas SessionModified
> >>
> >> which based on the project directory being 
> >> /usr/local/src/heavywethers/trunk implies 
> >> /usr/local/src/inifiles/trunk/dbconfigcode2.pas (I'm trying to be 
> >> cautious jumping to conclusions here).
> > 
> > see above.
> > 
> >  
> >> Source -> Unit Information -> General on the new DbConfigCode2(2) tab 
> >> tells me /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas 
> >> [manual transcript] which is what the file should be.
> > 
> > ok
> > 
> >> ... Unit paths 
> >> refers to /usr/local/src/heavywethers/inifiles/trunk which is OK. Source 
> >> paths ditto.
> > 
> > ok
> > 
> >  
> >> But Source -> Unit Information -> General on the original DbConfigCode2 
> >> tab tells me it's /usr/local/src/inifiles/trunk/dbconfigcode2.pas which 
> >> is wrong.
> > 
> > What is this "original"? When is it opened?
> > In my former mails I assumed you had opened it yourself.
> 
> dbconfigcode2 is the name on the tab created when the IDE (at startup) 
> read the project. I was assuming that dbconfigcode2(2) was the one that 
> the IDE created when the compiler reported the error, but looking at the 
> file paths I'm not entirely sure.

Reading the project simply restores the files last time open. That does
not count. Question still open: When was the wrong file opened?

 
> >> I need to be very cautious about jumping to any conclusions over this 
> >> (having already been wrong once), but it looks as though the compiler is 
> >> getting and reporting the right path
> >>
> >> Compiling /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas
> > 
> > yes.
> > 
> >  
> >> but the IDE at some earlier stage has resolved it to 
> >> /usr/local/src/inifiles/trunk/dbconfigcode2.pas which it shouldn't. 
> > 
> > What is this "some earlier stage"?
> 
> When the IDE was opening the project.

See above.

 
> >> That 
> >> actually fits my experience that given that sort of duplicate tab it's 
> >> safer to close the older one.
> >>
> >> If I close the older tab/pane, save-all and terminate then restart, the 
> >> one tab that's displayed relating to that file has the correct name 
> >> /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas.
> 
> ..up to this point where I've just done something that makes the 
> problem go away.
> 
> > All tabs are named uniquely. If you open two units with the same name
> > one will get the "(2)" appended. The "(2)" vanishes when the name
> > becomes unique again.
> 
> Yes, but which tab gets the suffix: the one that already exists or the 
> newly-created duplicate?

When a second is opened it gets the (2), the third gets (3), and so
forth. It does not matter which one is the project's one.

 
>[...]
> >> However I think that's something to do with the non-working OnClick 
> >> which I'll get back to presently, this business with tab/pane 
> >> duplication is at least a few weeks old.
> 
> So it looks as though it's something to do with the saved state of the 
> project, i.e. which files are listed as to be opened when the project is 
> loaded. The file giving the problem had been open (across multiple 
> sessions of the IDE) ever since the unit and associated frame was 
> created and saved, I can't remember exactly how I did the save (i.e. 
> whether it was an explicit save-all or an implicit save when the 
> compiler was run or the IDE shut down).

The does not matter for the session.

 
> If the compilation is run and finds an error where the file isn't 
> already open, the file is opened with the correct path and there are no 
> further problems.

Nice.

 
> Drat- it's just started happening again. The thing that appears to have 
> made the difference was telling the IDE to open the frame associated 
> with the unit, I can now see both forms of the path/name stored in the 
> .lps file:
> 
>        <Unit12>
>          <Filename Value="../../inifiles/trunk/dbconfigcode2.pas"/>
>          <IsPartOfProject Value="True"/>
>          <ComponentName Value="DbConfigFrame"/>
> ..
>        <Unit15>
>          <Filename Value="../inifiles/trunk/dbconfigcode2.pas"/>
>          <ComponentName Value="DbConfigFrame"/>

You can see that the IDE knows that Unit12 belongs to the
project, while Unit15 is simply a file on your disk. 

About "the IDE to open the frame associated with the unit".
Which file is "the frame" and which file is "the unit"?

Mattias




More information about the Lazarus mailing list