pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: HostFrame Size - How to calculate?
Date Thu, 21 Oct 2010 11:54:54 GMT
One problem with the code below is that your window may not have been instantiated by the time
sizeToFit() is called (I'm assuming that it is created in Application#startup(), which is
invoked in a callback). In general, I'd recommend that you call sizeToFit() in the startup()
method as well.

However, I just prototyped it myself and it turns out that there is a minor issue with this
approach (at least, in the 2.0 branch). The host window is opened before startup() is called,
so it will open at the default size and then visibly resize to the packed size. We did this
to work around another issue but I now see that it has an impact on sizeToFit().

On the other hand, I'm a little confused about what you are actually trying to do. If you
know you want the host frame to accommodate content that is 200x200 in size, why allow the
user to resize it at all?


On Oct 21, 2010, at 2:38 AM, MSafiri wrote:

> Dear Greg,
> Thanks for the hint. Here is what I tried to do......well, keep in mind,
> that I am not a developer, simply trying to give a hand to my colleague to
> finish the application faster...so:
>    public static void main(String[] args) {
>    	DesktopApplicationContext.main(cstProgressUpdate.class, args);
>    	DesktopApplicationContext.sizeToFit(window);
>    }
> I removed the lines which are calculating and setting the size of the
> HostFrame. However if the user is resizing the window and closing it, at the
> next start-up the window will have the size calculated after the resize.
> Cheers,
> MSafiri
> -- 
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/HostFrame-Size-How-to-calculate-tp1736915p1743843.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

View raw message