The UI rendering in Alloy seems to be inconsistent, but I am sure it is that I just don't quite fully understand it.
For instance, If I have a view like so
<View id="titleBar"> <View id="webControls"> <Label class="webButtons" id="back" text="?" /> <Label id="forward" text="?" class="webButtons" /> </View> <Label id="title" text="Description"/> <Label id="close" text="X"/> </View> <View id="description">
And I wanted calculate the $.title label.
In order to do that, I want to know the width of the $.close label and the $.webControls view.
Is it wrong to assume since $.close is the last element in the $.titleBar view, that if I set a postlayout event on $.close that all the other elements before it will be rendered?
$.close.addEventListener("postlayout", function(){ var cw, wcw, ttw, win; wcw = $.webControls.getRect().width; win = $.titleBar.getRect().width; cw = $.close.getRect().width(); });If I do this, about half the time one of the above elements is returning 0.
Without adding a postlayout event to each individual element, how would I go about calculating this when Iknow all the elements have been rendered?
Do I add it to the next sibling element to $.description Would that ensure that the above elements had been rendered?