Recent

Author Topic: Anchors - bug?  (Read 387 times)

Birger52

  • Full Member
  • ***
  • Posts: 125
Anchors - bug?
« on: September 14, 2019, 01:23:01 pm »
Win7 64bit
Lazarus 2.0.4

I have a panel.
Place a TBitBtn, and use anchors to place it inside the panel (Anchor top left and bottom to the panel it is placed in - no anchor right) - see image.
I place another TBitBtn and use anchors to place it inside the panel, but with left position in relation to the first button.

And it gives an error about circular dependency (Anchor top and bottom to panel. left to the other button and no anchor right) - see the other image ;)

Why? Where is the circular reference?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5800
    • wiki
Re: Anchors - bug?
« Reply #1 on: September 14, 2019, 01:37:26 pm »
What are the anchors / align / autosize of the panel?

Birger52

  • Full Member
  • ***
  • Posts: 125
Re: Anchors - bug?
« Reply #2 on: September 15, 2019, 11:38:51 am »
Anchor set as in attached images, align set to alNone, autosize is false.

Exiting Lazarus and reopening, places the second button, where it should be...

May have been align, disturbing. Pretty sure I checked tho.

Maybe setting an anchor should set align to alNone, automatically (like setting align to anything other than alNone, removes any anchor settings...)

wp

  • Hero Member
  • *****
  • Posts: 6495
Re: Anchors - bug?
« Reply #3 on: September 15, 2019, 12:35:06 pm »
Steps done trying to reproduce the issue:

- Win 10 (64bit), Laz trunk/fpc 3.0.4, both 32 bit.
- Create new project
- Add a panel to the form, set is Height to 24.
- Add a SpeedButton to the panel
- In the anchor editor anchor the top, left, bottom sides of the speedbutton to the corresponding sides of the panel; in case of the bottom use the lower anchor button and activate the Enabled checkbox.
- Add another SpeedButton to the panel
- In the anchor editor anchor its top and bottom sides to the panel, like with the first button, and anchor its left side to the first button, use the right anchor button of the left side.
- --> No circular dependency.

- Repeat with Laz 2.0.4/fpc 3.0.4 on same system --> No circular dependency.
- Repeat on a VM with Win 7 / 32 bit, Laz trunk/fpc3.0.4 and Laz 1.8.4/fpc 3.0.4 --> no circular dependency

So, I cannot reproduce the issue on a fresh project. I did notice previously, though, that the Anchor Editor sometimes is not forgiving circular dependencies introduced earlier, and sometimes its logics in complex layouts is not clear. However, I have not been able to find reproducible steps for this behavior.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Birger52

  • Full Member
  • ***
  • Posts: 125
Re: Anchors - bug?
« Reply #4 on: September 15, 2019, 02:03:19 pm »
OK

I'm using Win7 and a 64 bit Lazarus.
I have the same problem in another project - this time it is panels, giving a circular reference, when none exists.

Will look out for this...

wp

  • Hero Member
  • *****
  • Posts: 6495
Re: Anchors - bug?
« Reply #5 on: September 15, 2019, 02:17:12 pm »
Repeated my test with Laz 2.0.4/fpc 3.0.4 (64bit) on Win10 /64bit --> same result, no circular dependency. I don't have Win7 on 64 bit, but it's hard to believe that this issue depends on such a difference in the OS.

When you follow the steps that I described can you reproduce that a circular dependence is not observed? If yes, what is different between my steps and your form? How are the other controls in your form anchored?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

WooBean

  • Jr. Member
  • **
  • Posts: 89
Re: Anchors - bug?
« Reply #6 on: September 15, 2019, 02:44:10 pm »
@wp
Well, I managed reproduce the project opening trouble when repeating suggested steps (win7/64, Laz 2.0.4/FPC 3.0.4) while I created a new project, arranged components as suggested and then saved the project with a new name. When I try to reopen this project Lazarus IDE (2.0.4) keeps crashing when I switch IDE (docked) to Designer tab. I could see that at Designer tab the projects main form "tries" to align to all Designer's tab surface as a client. What is strange such project is properly opened with older Lazarus 1.8.0 IDE (both 32 and 64 bit versions and docked IDEs). It may be a clue for a culprit.

WooBean 
« Last Edit: September 15, 2019, 02:45:53 pm by WooBean »
Win7/64, Lazarus 1.8 win64-win64, FPC 3.0.4