Hey Erel,
Thanks for getting back to me.
I didn't realise that the script is run after the anchors are applied and that it has implications. I didn't see it mentioned in the beginners guide.
I have made a test layout file to try to understand what is happening.
Panel1 width is set using anchors.
Panel2 width is set in script using SetLeftAndRight
Label1 and Label3 are both set to left/right zero using anchors
Label2 and Label4 are set to right zero using anchors.
When the script is run and the width of Panel2 is changed, the right anchor point of Label3 and Label4 is not updated to reflect the new position of the Panel. I understand this now so I know how to work with that.
However, Label5 and Label6 are both set to right align with the right of the containing panel in script i.e. Label5.Right = Panel1.Right, Label6.Right = Panel2.Right. But instead of aligning with the right of their containing panels, they seem to be set to right = 0.
But, if I apply the same script to labels outside of the containing Panels, the right align works correctly i.e. LabelPnl1Right.Right = Panel1.Right correctly matches the right of the label with the right of the panel.
So it seems to me that the views that are children of the panel
can't access their parent's .Right value via script, but views that are not children of the panel
can access its .Right value.
Is this mean't to be the case? Or am I doing something wrong?
I've attached the test layout file.
Thanks