Recent

Author Topic: [resolved] current Lazarus master changes existing form layout  (Read 1458 times)

Muso

  • Sr. Member
  • ****
  • Posts: 347
I used FPCupDeluxe to install today's Lazarus master:
Lazarus 2.3.0 (rev main-2_3-1741-gbcf97404fa) FPC 3.2.2 x86_64-win64-win32/win64

I did nothing else than top open an existing project with FPCupDeluxe and after pressing save I get tons of these changes:
Code: Pascal  [Select][+][-]
  1. diff --git a/JTDriverSensingMain.lfm b/JTDriverSensingMain.lfm
  2. index 1e37176..f3df82e 100644
  3. --- a/JTDriverSensingMain.lfm
  4. +++ b/JTDriverSensingMain.lfm
  5. @@ -15,7 +15,7 @@ object MainForm: TMainForm
  6.    OnDropFiles = FormDropFiles
  7.    OnShow = FormShow
  8.    Position = poDesktopCenter
  9. -  LCLVersion = '2.2.2.0'
  10. +  LCLVersion = '2.3.0.0'
  11.    object MainPC: TPageControl
  12.      Left = 4
  13.      Height = 676
  14. @@ -52,6 +52,7 @@ object MainForm: TMainForm
  15.            EditLabel.Height = 15
  16.            EditLabel.Width = 108
  17.            EditLabel.Caption = 'Actual Signal [mM]'
  18. +          EditLabel.Color = clDefault
  19.            EditLabel.ParentColor = False
  20.            Enabled = False
  21.            TabOrder = 0
  22. @@ -61,7 +62,7 @@ object MainForm: TMainForm
  23.            Height = 19
  24.            Hint = 'Displayed in chart'
  25.            Top = 0
  26. -          Width = 36
  27. +          Width = 34
  28.            Caption = 'On'
I get for _every_ element now
EditLabel.Color = clDefault
added.
This seems unnecessary since the idea is that when something is he default, it is not written to the .lfm file.

The more severe this is that I get form many element a change in the width. I have my reasons why I set certain width values and Lazarus cannot just change them without even informing me that this is done and why.
« Last Edit: July 29, 2022, 08:17:35 pm by Muso »

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #1 on: July 27, 2022, 11:14:41 pm »
The clDefault issue probably is related to https://wiki.freepascal.org/Lazarus_2.4.0_release_notes#TLabel.Transparent.2C_.Color_and_.ParentColor_changes.

Another related consequence of this bug fix is that labels read from v2.2.2-lfm files now have their ParentColor set to false. Reset this to true, and the Color line will be removed from the lfm after saving (because the Parent has color clDefault, too).

I don't see any size change in the test that I did before writing this post. In your diff a PageControl is mentioned. IIRC there is/was an issue with autosizing related to PageControls. I'd speculate that the width changes that you see are due to it.

Be guaranteed: Nobody makes changes in published properties just for fun. 100% backward compatibility cannot be assured, and in fact every fixed bug breaks backward compatibility.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #2 on: July 27, 2022, 11:48:59 pm »
Another related consequence of this bug fix is that labels read from v2.2.2-lfm files now have their ParentColor set to false. Reset this to true, and the Color line will be removed from the lfm after saving (because the Parent has color clDefault, too).

How can I do this? My .lfm file is huge, see attached. Is there a preferences option available or do I have to use a text editor on the .lfm file?

I don't see any size change in the test that I did before writing this post. In your diff a PageControl is mentioned. IIRC there is/was an issue with autosizing related to PageControls. I'd speculate that the width changes that you see are due to it.

Maybe my .lfm file is then a good test. I attached it.

Be guaranteed: Nobody makes changes in published properties just for fun. 100% backward compatibility cannot be assured, and in fact every fixed bug breaks backward compatibility.

Sure and I did not accuse anyone. i just reported an issue I noticed.

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #3 on: July 28, 2022, 01:08:39 pm »
Another related consequence of this bug fix is that labels read from v2.2.2-lfm files now have their ParentColor set to false. Reset this to true, and the Color line will be removed from the lfm after saving (because the Parent has color clDefault, too).

How can I do this? My .lfm file is huge, see attached. Is there a preferences option available or do I have to use a text editor on the .lfm file?
Why not "Search & Replace" in an external editor? You cannot damage anything provided that you have a backup copy of the changed lfm file.

I don't see any size change in the test that I did before writing this post. In your diff a PageControl is mentioned. IIRC there is/was an issue with autosizing related to PageControls. I'd speculate that the width changes that you see are due to it.

Maybe my .lfm file is then a good test. I attached it.
You provided only the lfm file which is read by the IDE only as text. Please add the correspondig pas file, too.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #4 on: July 28, 2022, 02:15:21 pm »
How can I do this? My .lfm file is huge, see attached. Is there a preferences option available or do I have to use a text editor on the .lfm file?
Why not "Search & Replace" in an external editor? You cannot damage anything provided that you have a backup copy of the changed lfm file.
That was my question. So I have to use a text editor.

However, I think it is better when Lazarus' reader would remove existing
Code: Pascal  [Select][+][-]
  1. ParentColor = False
instead of keeping them and add on top
Code: Pascal  [Select][+][-]
  1. Color = clDefault

Maybe my .lfm file is then a good test. I attached it.
You provided only the lfm file which is read by the IDE only as text. Please add the corresponding pas file, too.
I attached this now.

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #5 on: July 28, 2022, 02:24:27 pm »
Maybe my .lfm file is then a good test. I attached it.
You provided only the lfm file which is read by the IDE only as text. Please add the corresponding pas file, too.
I attached this now.
The lfm is a v2.3 file now so that I cannot see what changes when a v2.2.2 file is upgraded to v2.3

[EDIT] Ignore this - the v2.2.2 lfm can be generated from the attachment of reply #2-
« Last Edit: July 28, 2022, 02:29:26 pm by wp »

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #6 on: July 28, 2022, 02:29:15 pm »
The lfm is a v2.3 file now so that I cannot see what changes when a v2.2.2 file is upgraded to v2.3
This works for me still:
- open my file with Lazarus master (from today)
- in the IDE make a change in the form (e.g. select a tab to make it the new current one, then select the initial tab)
- press save and close the IDE
result: see the attached diff

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #7 on: July 28, 2022, 04:44:46 pm »
These diffs are due to checkboxes. Since these checkboxes have no AutoSize entry in the lfm, and the TCustomCheckBox.AutoSize=true property is marked as default, the checkboxes are created with AutoSize=true. However, the AutoSize calculation has been changed in Laz/main (https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39398, incidentally by myself), and thus it is clear that each autosized checkbox has a different width in v2.3 than in v2.2.2.

Likewise, every other change of control dimensions in the conversion from v2.2.2 to main will have such a natural explanation (maybe not as well-documented as this one).

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #8 on: July 28, 2022, 05:17:46 pm »
it is clear that each autosized checkbox has a different width in v2.3 than in v2.2.2.

Many thanks for having a look!

I think the user should be informed. So then a lfm file from 2.2.x is loaded to 2.3.x, and a value in the .lfm file changes, he gets a nota that there are changes in the .fm file because of different auto-size calculation results.

This would have helped me because I made a change, wanted to commit this to my Git repo and saw more than 300 changes. I searched around, could not find anything and now I somehow stole your time to help me (sorry for that). I think others will face the same situation, therefore such an info will help the users but also the Lazarus developers to prevent reports.

-------------
What about my proposal with the Default Color?

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #9 on: July 28, 2022, 06:30:10 pm »
I think the user should be informed. So then a lfm file from 2.2.x is loaded to 2.3.x, and a value in the .lfm file changes, he gets a nota that there are changes in the .fm file because of different auto-size calculation results.

This would have helped me because I made a change, wanted to commit this to my Git repo and saw more than 300 changes. I searched around, could not find anything and now I somehow stole your time to help me (sorry for that). I think others will face the same situation, therefore such an info will help the users but also the Lazarus developers to prevent reports.
I doubt. Nobody reads the release notes, even you did not read the note about the label changes (I agree that the connection to your issue is not mentioned, it's more or less a side-effect of that fix, so be excused)... But anyway, I added a short note about the changes in TCheckbox/TRadioButton (https://wiki.freepascal.org/Lazarus_2.4.0_release_notes#TCheckbox.2C_TRadioButton).

And if you are thinking of a compiler message: Again, I doubt that anybody will find such a note among the myriads of hints and warnings that FPC spits out already today.

What about my proposal with the Default Color?
Report it to bugtracker. I won't touch this issue, though, maybe another developer will. But provide a simpler example, ideally just a form with a label. Your current form is too complex and the history of it is not known. Looking at your original v2.2.2 form of reply #2, for example, I see that all labels have ParentColor = false. How does it get there? Did you set it? Or is it a consequence of the linkage of ParentColor and Transparency in v2.2.2? Groupbox Channel1CB of your file has ParentColor= false when I load the file into Laz 2.2.2, but ParentColor is true when I load it into Laz main. Why? Due do another fix? Another issue? Or is it a side-effect of the same clDefault issue that is already fixed and documented in the link I gave above? This is a huge investigation with your sample file, I am afraid nobody will take the time...

My recommendation: Do not rely on the size of controls to be exact. Once Microsoft decides to choose another system font in the upcoming Win11 22H2 your carefully designed layout will be destroyed again... When you need specific alignment of controls you should take advantage of the anchoring method coming with Lazarus (https://wiki.freepascal.org/Autosize_/_Layout, https://wiki.freepascal.org/Anchor_Sides). If done correctly, the layout will always be perfect, no matter which operating system is used, or which language is selected in a multi-language application. Look at the IDE as an example.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #10 on: July 28, 2022, 07:37:04 pm »
And if you are thinking of a compiler message: Again, I doubt that anybody will find such a note among the myriads of hints and warnings that FPC spits out already today.
No, I meant a MessageDlg. So you see a popup the first time your LFM is converted from 2.2 to 2.3. This should do the job well from my perspective.

wp

  • Hero Member
  • *****
  • Posts: 10030
Re: [regression] current Lazarus master changes existing form layout
« Reply #11 on: July 28, 2022, 08:12:17 pm »
No. MessageDlg will be as annoying as the exception dialogs that appear today when a form with an unknown property is read from the LFM.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #12 on: July 29, 2022, 02:30:15 pm »
No. MessageDlg will be as annoying as the exception dialogs that appear today when a form with an unknown property is read from the LFM.
But that's the idea.
It should be that annoying that everybody is informed. It will also only appears once per form and only if something actually changed.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #13 on: July 29, 2022, 02:36:53 pm »
Your current form is too complex and the history of it is not known. Looking at your original v2.2.2 form of reply #2, for example, I see that all labels have ParentColor = false. How does it get there? Did you set it? Or is it a consequence of the linkage of ParentColor and Transparency in v2.2.2? Groupbox Channel1CB of your file has ParentColor= false when I load the file into Laz 2.2.2, but ParentColor is true when I load it into Laz main. Why? Due do another fix? Another issue? Or is it a side-effect of the same clDefault issue that is already fixed and documented in the link I gave above? This is a huge investigation with your sample file, I am afraid nobody will take the time...
I see. I started with the form with Laz 2.0.x, with every new Laz version I encountered some additions to the .lfm file despite I never dealt with the color settings. Therefore I assume the settings are there because of Lazarus's changes.

take advantage of the anchoring method coming with Lazarus (https://wiki.freepascal.org/Autosize_/_Layout, https://wiki.freepascal.org/Anchor_Sides).
Yes, I discovered it a while ago and setup all my forms with it. Only the particular big form of this thread made problems and I gave up. I will give it now another try.

Muso

  • Sr. Member
  • ****
  • Posts: 347
Re: [regression] current Lazarus master changes existing form layout
« Reply #14 on: July 29, 2022, 08:16:49 pm »
Yes, I discovered it a while ago and setup all my forms with it. Only the particular big form of this thread made problems and I gave up. I will give it now another try.

I did so and stumbled over the same issue than the last time. I investigated now a but further and started a separate thread:
https://forum.lazarus.freepascal.org/index.php/topic,60115.msg448883.html

 

TinyPortal © 2005-2018