[Lazarus] Making a form read-only

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Dec 27 13:51:54 CET 2012


Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> hat am 27. Dezember 2012 um
13:12 geschrieben:
> Mark Morgan Lloyd wrote:
>
> > 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.
>
> Explicitly, when the IDE finds an open .pas at startup it opens the
> corresponding form as a graphic even if it wasn't open when the IDE was
> last shut down,

Disable Tools / Form Editor / Open designer on open unit


> and even if the text representation of the .lfm is open.
> I think this is the root of my original complaint, plus there's no r/o
> property on the graphical representation of a form, and it doesn't
> inherit r/o from a text representation.

Lazarus defines the 'form' concept as the combination of unit sources plus lfm.
While the form is open the lfm is ignored (except for changes on disk messages).
You can open the lfm in the source editor, but form changes will automatically
overwrite the lfm. So in a way, the lfm is readonly while the form is open.
The readonly flag of the unit is used, not the readonly of the lfm source
editor.

Maybe the source editor of the lfm should be made readonly while the form is
open, although I found the current state useful a few times and no one has
complained yet.

A form can not really be made readonly because some things are not controlled by
the IDE. For example the window manager and theme changes. And some things have
cross-form side effects. For example editing the ancestor of a form.
Maybe a form can be marked as 'ask before saving changes'. But I wonder if this
setting should really be per-form or if it would be better defined in
categories, like all forms in a directory, or forms not belonging to the
project.


Mattias




More information about the Lazarus mailing list