[Lazarus] Making a form read-only
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Fri Dec 28 19:00:36 CET 2012
Hans-Peter Diettrich wrote:
> My recent (bad) experience from working with D5 is, that the form layout
> should be protected better against inadvertent changes, at least in
> Lazarus. When my VM window was shrunk recently, all open forms were
> resized, even if only the .pas file was open, and this change made them
> unusable at runtime :-(
>
> I'd really like an *option* (project setting!) to open a project with
> all forms locked. Then it would be possible to e.g. fix bugs in a
> project without risking changes to the DFM/LFM files. In a long-term
> (commercial...) project *no* single developer, and *no* IDE, should be
> allowed to change the *appearance* of the program accidentally.
Defending the orthodox position as expounded by Mattias, his suggestion
of unchecking "Open designer on open unit" works all the way back to
0.9.24 (possibly beyond, but I can't realistically see anybody wanting
to go older). Adding an in-form property to lock its content would have
limited benefit in mixed-version work, since unless it was something
that irreparably broke the designer (but still left the form compilable)
it would either be ignored/discarded or would break the project.
I started using svn locally a year ago and am glad of it: now that I
know about the problem, I can simply look for and revert changed
forms... provided obviously that there hasn't been a bona-fide change in
the .pas which has affected the appearance.
Using filesystem properties as the starting state for a form or unit
being locked down would obviously be a possibility, but I don't know how
tolerant the IDE is of that. Another way would be to lock files based on
some property of a VCS repository (svn, git or whatever), but again
there's a risk that the IDE would accept changes and then bomb on any
attempt to save them, leaving a project inconsistent.
Elsewhere, I've been advocating some system of giving developers
privilege tokens so that- e.g.- the office junior doesn't mess directly
with pointers and assembler. I think you've reached much the same
conclusion.
--
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