Recent

Author Topic: Form editor 'Lock' feature suggestion  (Read 422 times)

y.ivanov

  • Sr. Member
  • ****
  • Posts: 436
Form editor 'Lock' feature suggestion
« on: July 03, 2022, 12:41:31 pm »
It often happens that someone works on a project at different PC's with different OS'es and/or different monitors. As a result of that *.lfm files get inadvertently changed, mostly top/left/width/height props, and  then file goes into version control with many many changes, probably unwanted.   

See: https://forum.lazarus.freepascal.org/index.php/topic,59784.0.html

Wouldn't it be good for the form designer to have a 'Lock' feature and all automatic adjustments to be postponed until unlocked or just asked for confirmation for saving when only such (internal) modifications were made?

Or, more generally, to not allow any modifications until the form explicitly 'Unlocked'?

I know the issue is well beyond that, but IMHO such a feature will help people like me, which is aware of the problem but doesn't want to pollute the repo with unnecessary changes.

Regards,

   
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

MarkMLl

  • Hero Member
  • *****
  • Posts: 4734
Re: Form editor 'Lock' feature suggestion
« Reply #1 on: July 03, 2022, 02:14:43 pm »
I strongly agree, however we also need to consider whether it locks/unlocks all forms/frames or if it happens individually (particular case: a form containing a frame can be usefully locked down even if the frame itself is editable).

However we also have to consider the support load: we're likely to see a lot of less-experienced users who don't realise that they've locked a form, and forum commenters who don't consider that possibility when dispensing advice.

An alternative would be a global setting which required confirmation of any form/frame change that didn't go via the object inspector, to prevent accidental moves or "corrections" applied by the LCL variant associated with a particular widgetset.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Bart

  • Hero Member
  • *****
  • Posts: 4724
    • Bart en Mariska's Webstek
Re: Form editor 'Lock' feature suggestion
« Reply #2 on: July 03, 2022, 10:51:21 pm »
Personally I always check if the lfm has changed before committing.
If so, and the changes are "automatically" I revert the lfm (svn revert/git restore).

Bart

y.ivanov

  • Sr. Member
  • ****
  • Posts: 436
Re: Form editor 'Lock' feature suggestion
« Reply #3 on: July 04, 2022, 12:51:07 am »
Personally I always check if the lfm has changed before committing.
If so, and the changes are "automatically" I revert the lfm (svn revert/git restore).

Bart
Same as I do. But it is an additional effort, sometimes a file just goes through inadvertently.

IMO feature is also helpful when you have finished with the layout work but you're clicking on controls to add event handlers or to change other non-layout properties. Then often happens that the control gets accidentally "nudged" by the mouse click.

I've spent last few hours browsing the Lazarus IDE sources. What I've found is that the form will not get "modified" just by internal PPI scaling, it must be additionally "touched" somehow, e.g. I often just move aside forms standing my way and obscuring other windows.   

Nevertheless, I think such a lock will be a nice feature. AFAIR Delphi7 has similar into the form editor context menu although it was limited.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

dbannon

  • Hero Member
  • *****
  • Posts: 2045
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Form editor 'Lock' feature suggestion
« Reply #4 on: July 04, 2022, 03:54:51 am »
Yes, it would be good to have a solution but, as Mark pointed out, it could end up causing more problems by complicating things.

If a lock just ignores changes, someone is bound to loose intentional changes, if the lock asks the "are you sure" on every change, it will drive me crazy. Almost as bad if it asks at every (auto) save before run.

I personally move a form out of the way a lot, the actual form position is set at run time (from my code) so does not matter. Would it be possible to have some properties locked and not some others ?  Does sound even less certain ....

Write form changes only at IDE exit ?  I always exit before committing to git but I am sure other people do not.  And that approach would make the compile a lot more complicated too, the compiler would need to look at hidden form files. No, sorry, too much trouble.

Maybe, the IDE could offer to revert a form file at exit, showing a summary of changes ?  Be better than what git diff shows ....

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

MarkMLl

  • Hero Member
  • *****
  • Posts: 4734
Re: Form editor 'Lock' feature suggestion
« Reply #5 on: July 04, 2022, 10:10:27 am »
Hence my suggestion for a confirmation if anything other than a manual change via the object inspector tried to update a form.

Can a closed form (i.e. .pas open, .lfm closed) suffer from unintentional updates (e.g. in response to a DPI mismatch)?

MarkMLl


MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018