[Lazarus] Making a form read-only

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Dec 27 15:16:08 CET 2012


Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> hat am 27. Dezember 2012 um
14:46 geschrieben:
>[...]
> > 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.

I just pointed out, that the r/o file setting of the lfm source editor is
somewhat difficult.
Most people hardly open/edit the lfm directly. They expect the r/o flag of the
unit to apply to the form.
Applying both r/o flags (unit and lfm) will cause confusion.


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

Well, yes, not everyone likes micro management at every place. One solution
would be to ask when setting r/o to change it for the lfm/unit too. Another
would be some way to mark whole categories/directories r/o.


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

Themes define sizes too.


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


Mattias




More information about the Lazarus mailing list