with one exception: if files become corrupted in a way other than editting an lfm/dfm
However it would be better if there could be some consensus that the IDE shouldn't get them into a state where they- on rare occasions- /had/ to be edited manually.
This, this - so much this. I only manually edit a .lfm when the IDE can no longer open it. I consider it a last resort, but it's happened twice to me in the last couple of weeks for different reasons. However I do understand an IDE may have bugs or flaws - there is complexity. It would be nice if IDE handling of .lfm files were improved for fault tolerance.
Hmm... I think I may have struck a nerve.
I wonder whether it could (almost) always be designed to present the option: "There's a problem with this .lfm - would you like to auto-fix it and open anyway (this might remove the offending component and/or properties) ? Or cancel." An error like "Can't find an ancestor class, so I refuse to open it" feels unhelpful. Please don't take this the wrong way!
A neat approach might be: on opening .lfm file, if a class (or ancestor class) is missing, swap the offending control to a TPanel, but keep any left, top, width, height and alignment properties, so that the overall layout of the form is not compromised.
I did have a look through the Lazarus lfm file opening code with a view to perhaps making some tweaks - but it does look quite scary in there.
Make sure that the main form is not open in the designer/IDE before making changes to the frame.
Thank you - that is worth bearing in mind.
Arguably, the IDE should treat an instantiated frame as read-only.
Oh absolutely, by default. Then it could be a simple reference, like an include, without any inherited entries to deal with, so more robust.