Recent

Author Topic: What does this mean "TControl.InvalidatePreferredSize loop detected"?  (Read 1119 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1147
    • HowTos Considered Harmful?
I'm using a whole load of TSplitters to adjust a complicated panel side and I get this error message:


Quote
TControl.InvalidatePreferredSize loop detected :TPanel Bounds=l=0,t=0,r=0,b=30.

Press OK to ignore and risk data corruption.
Press Abort to kill the program

What does this mean and what is the cause?
Lazarus 3.0/FPC 3.2.2

Joanna from IRC

  • Hero Member
  • *****
  • Posts: 1348
Re: What does this mean "TControl.InvalidatePreferredSize loop detected"?
« Reply #1 on: February 20, 2024, 01:43:40 pm »
I’ve never tried more than one splitter at once. Do the splitters have panels in between them?
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: What does this mean "TControl.InvalidatePreferredSize loop detected"?
« Reply #2 on: February 20, 2024, 02:14:13 pm »
I just guess, by the numbers written in that error dialog, that you try to go negative with dimensional values, what is not possible.
Create a small minimalistic demo and attach project with such error.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Thaddy

  • Hero Member
  • *****
  • Posts: 16781
  • Ceterum censeo Trump esse delendam
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

wp

  • Hero Member
  • *****
  • Posts: 12756
Re: What does this mean "TControl.InvalidatePreferredSize loop detected"?
« Reply #4 on: February 20, 2024, 04:01:36 pm »
TControl.InvalidatePreferredSize loop detected :TPanel Bounds=l=0,t=0,r=0,b=30.
What does this mean and what is the cause?
Some LCL methods refer to the "PreferredSize" which relates to the size of a control when it's AutoSize property has been activated. Usually this is onlya predefined value for the width and/or height or a control. But it also depends on many other conditions which override the PreferredSize (Align, Anchoring, OnResize, autosizing of related controls). Unfortunately AutoSizing is one of the most complicated processes in the LCL (in my opinion), and it is relatively easy to run the entire process into conditions from which it cannot recover. And this is when this annoying message is displayed. I usually get it when I apply impossible conditions for anchoring; in this case, I can only shut down the IDE, open the LFM form in an external editor, revert the change that I made and fix "strange" (= very large) Left/Top values of affected controls.

Thaddy

  • Hero Member
  • *****
  • Posts: 16781
  • Ceterum censeo Trump esse delendam
Re: What does this mean "TControl.InvalidatePreferredSize loop detected"?
« Reply #5 on: February 20, 2024, 04:18:15 pm »
Yes. And see the link to the wiki.
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

 

TinyPortal © 2005-2018