[Lazarus] Making a form read-only

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Dec 27 11:45:05 CET 2012


Mattias Gaertner wrote:
> On Thu, 27 Dec 2012 09:45:27 +0000
> Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:
> 
>> [...]
>> I'm OK with the idea of the .lfm being updated if I do something to the 
>> form. But the current situation- and I think this is comparatively 
>> recent- is that the .lfm is updated even if it's not explicitly open.
> 
> To update a .lfm the IDE must have an open form, because that's what
> TWriter requires.
> Maybe you mean an open form was saved, even though you have not
> modified it?
 >
 > BTW, you can mark a unit read-only.

Got that, checking carefully using Lazarus 1.0. What's happening is that 
if multiple copies or representations of a file are open, the r/o state 
doesn't necessarily propagate. As a particular example, if you clone a 
r/o file to a new window that doesn't inherit the r/o state (at least 
until the IDE is restarted).

So if you tell the IDE to open a form as text (.lfm) and mark that r/o, 
close the graphical representation and update the .pas then the .lfm 
doesn't get LCLVersion stuffed into it. But if you close the IDE and 
then restart it, you've got the form both as a text and a graphic 
representation: under this condition if you update the .pas the .lfm is 
also updated, even though in its text representation it's still marked r/o.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list