Hi Red,
We have a setter - setPosition, but can we also get a getter - getPostion for UIElements?
Hi Red,
We have a setter - setPosition, but can we also get a getter - getPostion for UIElements?
Not a biggie (I have a workaround)
It's a bit tricky... basically UI elements no longer have a position like that (unlike the Java version), instead the Style only has left, right, top and bottom values. "setPosition()" is basically just a helper method which sets the "left" (x) and "top" (y) properties (and also sets the "position" property to "Absolute").
If there was a "getPosition()" method, it wouldn't be reliable and it's behaviour would be a bit confusing... one would expect it to return the current position of the element, but this can't be queried actually (because due to the flex layout, the position isn't necessarily defined through the left and top properties). For example, if you set the "right" property and also define a width, calling "getPosition()" would return 0 (which is obviously wrong), because it would just read the "left" property, which hasn't been set in this case. In fact the position depends on other style properties as well.
It's ok, I have a workaround for this one
Don’t have an account yet? Create a new account now and be part of our community!