Attached is my wtkx file. For one button the aspect ratio worked great, but for 
two and three buttons they get progressively smaller.

On Fri, 7 Aug 2009 12:41:01 pm Greg Brown wrote:
> For an example, see:
>
> http://svn.apache.org/repos/asf/incubator/pivot/trunk/wtk/test/org/apache/p
>ivot/wtk/test/preferred_aspect_ratio_test.wtkx
>
> G
>
> On Aug 6, 2009, at 10:36 PM, Greg Brown wrote:
> > OK, TerraPushButtonSkin now properly respects the
> > "preferredAspectRatio" style. If you set it to 1 (and the parent
> > container respects the button's preferred size), you'll get a square
> > button.
> >
> > However, you won't be able to simply rely on the box pane for
> > calculating the correct preferred height for all of the buttons. The
> > (unconstrained) preferred height of the box pane is still going to
> > be determined as the sum of the unconstrained preferred heights of
> > the buttons. Only when the width of the box pane is constrained can
> > we determine the actual button heights (since they depend on the
> > max. button width, which isn't known until layout - it is not, and
> > cannot be, known at preferred size calculation time).
> >
> > So, you identified a valid issue - thank you! But in order to meet
> > your use case, you'll need to ensure that the box pane is given
> > enough vertical height to accommodate all the buttons - that height
> > can't be determined automatically. Even a scroll pane or panorama
> > can't help here - your box pane must simply be given enough vertical
> > screen real estate to display all of the buttons.
> >
> > Hope this helps.
> >
> > G
> >
> > On Aug 6, 2009, at 9:47 PM, Greg Brown wrote:
> >> I understand your use case. I think that a vertical box pane with
> >> fill set to true would meet your needs, if we can get PushButton to
> >> behave correctly with respect to preferred aspect ratio.  :-)  I'm
> >> looking into it right now.
> >>
> >> On Aug 6, 2009, at 9:42 PM, Scott Lanham wrote:
> >>> Thanks Greg,
> >>>
> >>> What I originally expected aspect ratio to do is to increase the
> >>> smallest of
> >>> either height or width to keep the ratio constant. But my focus is
> >>> only on my
> >>> own needs so it is hard to see the big picture. It turns out a
> >>> square button
> >>> looks terrible when I did get it working and I ended up using an
> >>> aspect ratio
> >>> of 1.2. To get that ratio to work I had to set preferred height
> >>> but I don't
> >>> like setting explicit dimensions if it can be avoided though.
> >>>
> >>> What I am ultimately trying to do at the moment is create a
> >>> vertical "toolbar"
> >>> that keeps all buttons the same size. The size of the buttons are
> >>> dictated by
> >>> the button with the largest content and the aspect ratio is to
> >>> keep all the
> >>> buttons at a nice shape. One of the apps I work on is touch screen
> >>> based so
> >>> keeping the buttons large and a nice shape is important.
> >>>
> >>> On Fri, 7 Aug 2009 11:21:22 am Greg Brown wrote:
> >>>> Preferred aspect ratio currently affects the height if it is less
> >>>> than
> >>>> 1, and the width if it is greater than or equal to 1. However, I
> >>>> can
> >>>> see why you might expect that setting it to a value of 1 would
> >>>> produce
> >>>> a square button. I'll look into that.
> >>>>
> >>>> In the meantime, your best bet is to either a) use square content
> >>>> (such as an icon whose width and height are equal) or b) manually
> >>>> set
> >>>> the preferred width and height to the same value.
> >>>>
> >>>> G
> >>>>
> >>>> On Aug 6, 2009, at 8:44 PM, Scott Lanham wrote:
> >>>>> Hi,
> >>>>>
> >>>>> I would like to create a PushButton that stays square no matter
> >>>>> what
> >>>>> its
> >>>>> button data contains. I have tried to set preferredAspectRatio
> >>>>> to 1
> >>>>> but it
> >>>>> only appears to affect the button width. Is there any way I can
> >>>>> keep
> >>>>> a button
> >>>>> square besides setting the preferred height and width to be the
> >>>>> same?
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> Scott.

Attachment: applicationUi.xml
Description: XML document

Reply via email to