Correct - this is by design. In Pivot, a window's size is defined by its 
preferred width and height properties rather than the actual width and height 
properties. This is because, like all other components, a window relies on its 
parent container (an instance of Display) to set its size. During layout, 
DisplaySkin sets the size of the window to its preferred size, whether 
explicitly defined by the caller or determined by the window's skin. When an 
explicit preferred size is not set, TerraFrameSkin (which TerraDialogSkin 
extends) reports a preferred size based on the size of its content. The 
"resizable" style is ignored in this case. However, if either preferred width 
or height is set, the flag is respected.

This is different from AWT/Swing, which uses the pack() method to size a window 
to its content. In Pivot, packing happens automatically when one or both 
preferred dimensions is not set.

Hope this helps.

Greg


On May 26, 2010, at 12:11 PM, Chris Bartlett wrote:

> I've been struggling for a few hours trying to figure out how to make a   
> org.apache.pivot.wtk.Dialog   resizable.   (Using a copy of the 1.5 trunk 
> refreshed earlier today)
> 
> Using   org.apache.pivot.tutorials.windows.Windows   as a base, I modified   
> 'dialog.wtkx'   to include    styles="{resizable:true}"   in the Dialog 
> element.
> 
> This doesn't have any effect unless the   preferredWidth   and/or  
> preferredHeight  properties are also set.
> The code in   org.apache.pivot.wtk.skin.terra.TerraFrameSkin.mouseMove()   
> suggests this is deliberate.
> 
> Am I missing something here as to why the preferred width & height are 
> relevant, or should this be classified as a bug?
> IMHO settiing the   resizable   style should allow the Frame/Dialog to be 
> resized (unless it is maximized). 
> 
> Regards,
> 
> Chris
> 
> 

Reply via email to