Found something: It looks like the width constraint lives in the window?
Dim c As iOSLayoutConstraint = Self.Constraint("MyWidth")
Calling this from a window method returns the constraint, but it’s not where I would expect it. If I were creating this type of constraint and manually attaching it to my container control, it would be a part of the container control, not the window.
(And the docs are still missing for this function, AFAIK)
Constraints affecting the position and size of an element always live on the parent control because they can affect other controls and the layout resolver needs access to them all to solve the equation.
If this constraint were created programmatically, in XOJO or Obj-C/Swift, there isn’t a second item. The constraint would be attached to the control itself, not its parent.
May I ask why fixed Height and Width are stored in the parent? Did it have to be this way?
The knock-on effect is that when you reparent a control, the fixed height or width is lost. I’m not even able to read it correctly from the control’s height or width properties—wrong values are reported in the Opening event—I’d happily add the constraint back if I could get the values.
For instance, this MobilCanvas has it’s width and height set to 40 and 20:
This is a non-issue with native iOS auto layout, so I’m wondering why. iOSLayoutConstraints seem iOS specific, so it’s not for Android compatibility? Is it because XOJO only has a flat view/control hierarchy at runtime, unlike native iOS?