Constraints

Creating a constraint in code. Want to set the top and left positions (height and width appear to work). Get this error:

'A multiplier of 0 or a nil second item together with a
'location for the first attribute creates an illegal constraint
'of a location equal to a constant. Location attributes must be specified in pairs.

Why?

Can you paste the code you are using?

Having though about it some more, I very carefully set up the call to the constraint constructor providing the screen and the relation etc. It’s working.

The error actually make sense. When one sets the width or height, they’re attached to the object being constrained. When one sets the location, it must be relative to some enclosing object (i.e. the screen).

Things are working.

On to next disaster.