views:

815

answers:

1

If I don't specify width and height values for a TitleWindow, it will be resized to fit it's contents when I show it using PopUpManager.

But there are moments when some components inside will be resized, like a ComboBox which dataProvider is loaded asynchronously, or another component which was not visible and I'd like to set it's includeInLayout to true.

In those moments, I'd like to tell the TitleWindow to resize itself to fit window contents. I've tried calling invalidateSize() and invalidateDisplayList() with no success.

Is there a way to do this?

A: 

Try to call these two methods:

titleWindow.invalidateSize();
titleWindow.validateNow(); // or titleWindow.validateSize()
zdmytriv
I've tried that already. Nothing happens.
leolobato
Now it worked: I had a ViewStack inside the titleWindow, so I had to set it's percentWidth to NaN and resizeToContent=true before calling invalidateSize(). Also, I had to set percentWidth to NaN in the conainers inside that ViewStack. After that, the TitleWindow started measuring properly. Thanks!Just a quick reminder if anyone else has this issue: don't forget to set explicitWidth/explicitHeight of the TitleWindow to NaN so that it will adjust itself to it's contents.
leolobato