Recent

Author Topic: Way to lock lfm parameters needed  (Read 1918 times)

OH1KH

  • Jr. Member
  • **
  • Posts: 63
Way to lock lfm parameters needed
« on: June 30, 2020, 01:05:46 pm »
Hi
When opening a form for add/change one or more properties of it Lazarus always changes lot of width height etc parameters if form is touched. This is specially annoying when doing group programming and every programmer has different monitor(s) and way to place items to desktop.

Is there a way to lock these values from IDE or is the only way to backup all lfms before start and then do diff after change(s) are done and manually fixing lfm parts that should not change before pushing them up to Git?


--
Saku

Handoko

  • Hero Member
  • *****
  • Posts: 5143
  • My goal: build my own game engine using Lazarus
Re: Way to lock lfm parameters needed
« Reply #1 on: June 30, 2020, 01:21:39 pm »
I never have such problem.

I don't know why that happens on you, but I sometimes want to have the form's runtime size and position differ from its design time. Here is the code, maybe it can be useful to you too:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   Height   := 300;
  4.   Width    := 400;
  5.   Position := poScreenCenter;
  6. end;

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Way to lock lfm parameters needed
« Reply #2 on: June 30, 2020, 02:34:15 pm »
Is there a way to lock these values from IDE or is the only way to backup all lfms before start and then do diff after change(s) are done and manually fixing lfm parts that should not change before pushing them up to Git?

Any modified file will leave a "bak" copy of how it was before. Problem is that by default there will only be one, so if you save the form (or its unit) several times the initial state might be lost. What we do to avoid that is to set the IDE so that it makes numbered copies (see attached image) and we then use a toool we built that makes a combined diff of all the backup files in sequence (i.e. oldest vs. next, ... 3 vs. 2, 2 vs. 1, 1 vs. newest).

We use this "combined diff" mainly to generate (and check) the history log but it's also useful to do what you want, i.e. revert some "automatic" changes manually with the help of a text editor.

HTH! ::)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

OH1KH

  • Jr. Member
  • **
  • Posts: 63
Re: Way to lock lfm parameters needed
« Reply #3 on: July 01, 2020, 08:22:17 am »
I never have such problem.

I don't know why that happens on you, but I sometimes want to have the form's runtime size and position differ from its design time.

Just open from project/forms a form and drag it a bit. Close IDE and compare backup lfm and current lfm you dragged. If lfm is complex you see that many values have changed when you just "peek" the frame layout without doing any change.

It does not matter if you work alone and your project loads form place and size from setup (like you proposed). But if there are several  programmers who use  GitHub for common project those changes are annoying. Specially when Git automatic merge can not handle them forcing to manual merge where you have to dig out what is the real change and what are those "accident" position changes.

Thanks for all!
It just seems that backing up lfm before start, then diff after changes have been made, and manually removing all changes that do not affect to target itself is the only (and stupid) way to resolve this.
--
Saku

Handoko

  • Hero Member
  • *****
  • Posts: 5143
  • My goal: build my own game engine using Lazarus
Re: Way to lock lfm parameters needed
« Reply #4 on: July 01, 2020, 09:30:54 am »
I just did a quick test. No, nothing was changed.

I opened a project, moved the form, resized the form and closed the project. I was asked to save the changes. If I answer no, then nothing is changed and there will be no new bak file nor backup folder created.

What you said is a very serious issue. If I experienced it, I would be sure to report it.

I use Lazarus 2.0.8 Linux.

-edit-
If you compile/build/run the project, all the changes will be automatically saved without asking you.
« Last Edit: July 01, 2020, 09:38:25 am by Handoko »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Way to lock lfm parameters needed
« Reply #5 on: July 01, 2020, 10:36:18 am »
I just did a quick test. No, nothing was changed.

I opened a project, moved the form, resized the form and closed the project. I was asked to save the changes. If I answer no, then nothing is changed and there will be no new bak file nor backup folder created.

What you said is a very serious issue. If I experienced it, I would be sure to report it.

I use Lazarus 2.0.8 Linux.

-edit-
If you compile/build/run the project, all the changes will be automatically saved without asking you.

A concrete example: I use a couple machines, an old one with  a with a 1024x768 screen and another with a 1366x768. Now, a project is started in the first machine with a 600x400 form at, say, (240,200) and then moved to the second machine. Since the screen is wider, you can have, for example, a wider Project inspector so you move the form a little to the right to have it fully visible and keep building the project: change some properties in the PI, add code, compile, test, rinse and repeat. Perhaps you even make the form a little wider to adjust for the wider machine...

The net result is that after all that most or all properties relating to the position (and maybe size) of the form have changed, so when you move the project back to the first machine to keep going on it, it doesn't look quite right ... much less if the machines have different DPI!

That's the "problem" and it has no easy solution since, in fact, you changed those properties and that has to be reflected in the form file.

I don't really mind much, there's little difference between these two (and in fact most of the other) machines, but it's easy to see what might happen if one of them had an even wider or high-dpi screen %)
« Last Edit: July 01, 2020, 10:37:53 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018