Forum > Designer

Strange effect with form DockedFormEditor

<< < (2/3) > >>

prof7bit:
Regarding your question: I used to work with 92 DPI for a while, this was caused by the proprietary nvidia driver, this was annoying, I have now fixed the dpi at my development workstation to 96 with xrandr and now Lazarus reliably gets the 96 every time.

But this does not seem to be related, it still keeps happening in my 96DPI environment with forms saved with 96dpi.

Some new observations from today:

* DPI awareness and scaling is enabled, Designtime DPI is (and remains) at 96
* i18n is enabled, resourcestrings also exist in the code.
* I have my project committed in git, so I can immediately see if files changed.
* The project has 3 forms:
    ->  all of them have been saved with dockedformeditor
    ->  none of them contains LCLVersion
    ->  Client size is still correct in all forms.
* project is committed to git in exactly that state, so I can reset whenever I need.

* Lazarus is closed.
* I start Lazarus, it loads the project.
* run | build   -> git diff shows no changes to any files
* Project | resave forms with i18n
    -> LCLVersion inserted in all 3 forms,
    -> 1 out of 3 forms has messed up client size (251*412 instead of 611*1092)

* close Lazarus
* git reset --hard

* I start Lazarus, it loads the project
* I rebuild Lazarus without DockedFormEditor
* It restarts and loads the project again
    -> still no changes in git diff, project is still untouched
* Project | resave forms with i18n
    -> LCLVersion inserted in all 3 forms
    -> everything else remains untouched, no corruption

* close Lazarus
* git reset --hard

* I start Lazarus, it loads the project
* rebuild Lazarus with DockedFormEditor
* It restarts and loads the project again
    -> project is still untouched
* Project | resave forms with i18n
    -> LCLVersion inserted in all 3 forms
    -> same form as above has the exact same wrong values in client size

(repeating the above steps as I type it)

The form has a TChart on it, a bunch of Buttons, some TStaticTexts, a TMemo and a TRadioGroup. Chart is anchored on all 4 sides, buttons are ancored bottom right, memo is anchored top, left, bottom. Radiogroup and TStaticTexts are anchored top,left.

The TRadioGroup also has ClientHeight and ClientWidth and these are also changed, but not as dramatic as the values of the form.

One of the other forms that did not corrupt (today) also has a tchart with anchors on all 4 sides on it.

----

I also have a small demo project with some elements on a form for trying to provoke the problem there, so far no success. I am making all kinds of changes there, playing with anchors and panels, closely watching the git diff after every step and committing every tiny little change, and as soon as I manage to get it into the same state where it corrupts right after opening I will post it and also file a bug, because then I can provide steps to reproduce. But so far no luck.

prof7bit:
One more observation:

* Lazarus is closed, DockedFormEditor is installed.
* project files are reset to the state above

* I start Lazarus, it loads the project
* I change 1 letter in the code of the offending form (not in the design!)
* I hit Ctrl + S (save)
    -> LCLVersion is inserted into lfm (only this form, others untouched)
    -> client size is corrupted as above

* I do NOT restart Lazarus now
* I do NOT reset from git

* .lfm is still in the freshly corrupted state
* I click the form tab
* In the object inspector I change the witdh from 1092 to 1091, hit <enter>
* Click Save button in toobar
* In the object inspector I change the width from 1091 back to 1092, hit <enter>
* Click Save button in toobar

* corruption disappears, lfm file disappears from git diff, is back in original state!

* I make another small change in the code (like above) and Ctrl + S
    -> NO corruption
* Project | resave forms with i18n
    -> NO corruption
* now I can work on the project without further corruption. Until I close and reopen Lazarus.



prof7bit:
And the last one for today (probably)

* Project is reset in the state as above
* Start Lazarus, it loads the project
* Click on the form tab of the offending form (DockedFormEditor)

* change a property
* save it
    -> No corruption
* change it back to where it was
* save it
    -> No corruption
    -> file is clean again
* Project | Resave with i18n
    -> LCLVersion appears
    -> No corruption
* Change the code and save
   -> No corruption

* Change a property with DockedFormEditor and save
    -> LCLVersion disappears
    -> No corruption

* Edit some more code
    -> no corruption

----------

So it seems to me the corruption can only ever happen when
  * Lazarus just has been started
  * The DockedFormEditor has not yet been used
  * the form was saved because of i18n
  * the form was saved because of code change in form unit

As soon as DockedFormEditor has been used only just once the problem completely disappears!

Final and most important observation:

* Project is reset as above
* Start Lazarus, it opens the project
* Click on every form in the source editor and click on the form tab, just click the tab to show the formeditor, nothing else!
* Project | Resave with i18n
    -> no corruption
    -> not even LCLVersion, files remain unchanged!
* Edit code in the form units and save
    -> lfm files remain unchanged!

So as soon as the dockedformeditor has been shown (for each form) just once the problem disappears for the rest of the session until I restart Lazarus. Some initialization seems to be missed!





JuhaManninen:
LCLVersion should be saved with both form editors IMO. It depends on the version of LCL and nothing else.
The corruption issue is caused by something else of course.

prof7bit:

--- Quote from: JuhaManninen on September 30, 2021, 05:54:01 pm ---LCLVersion should be saved with both form editors IMO.

--- End quote ---
Yes, but currently it serves as some kind of hint or marker when it is executing one code path or the other. And the occasional appearance of LCLVersion correlates 100% with the appearance of the lfm corruption, maybe it helps coming closer to the underlying cause of this strange behavior.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version