[Lazarus] Making a form read-only

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Dec 27 14:46:04 CET 2012


Mattias Gaertner wrote:
> Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> hat am 27. Dezember 2012 um
> 13:12 geschrieben:
>> Mark Morgan Lloyd wrote:

>> 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

Thanks, noted :-)

>> 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.

But the r/o flag comes off "File settings", rather than from a per-unit 
setting in e.g. Project Inspector. Presumably these issues also apply to 
e.g. line termination.

> 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.

Maybe. I think some way of locking the form down would be useful, as 
supported by (at least some versions of) Delphi. I'm not so much 
complaining now that I've a better understanding of why I was seeing 
problems... except that I think setting one representation of a unit or 
form r/o and still being able to change it via other representations or 
windows is undesirable.

> 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.

But while things like size changes apply to the content of a form, theme 
changes wouldn't- only to its presentation during design.

I accept that I'm very much in a minority here. I wouldn't really have 
noticed anything if I didn't have a very small number of programs that 
I'm trying to keep working from everything like GTK1 and NT4 onwards: in 
general experience suggests that that sort of effort is more hassle than 
it's worth.

-- 
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