Recent

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

vfclists

  • Hero Member
  • *****
  • Posts: 1152
    • 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

  • Hero Member
  • *****
  • Posts: 1414
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?

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: 18672
  • Jungle wars. And failing health it seems.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

wp

  • Hero Member
  • *****
  • Posts: 13328
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: 18672
  • Jungle wars. And failing health it seems.
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.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018