pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Square PushButton
Date Mon, 10 Aug 2009 12:38:34 GMT
It is worth considering. Can you provide a patch that implements your  
proposed solution so we can take a look?

On Aug 9, 2009, at 10:49 PM, Scott Lanham wrote:

> I have been looking at and playing with TerraPushButtonSkin. As far  
> as I can
> see looking at aspect ratio as being preferred rather than minimum  
> but also
> being able specifying which of either height or width (never both)  
> are modified
> to achieve it would satisfy both our use cases. What do you think?
>
> On Fri, 7 Aug 2009 02:10:35 pm Greg Brown wrote:
>> You know...now that I think about it, perhaps my most recent change
>> was misguided. The term "preferredAspectRatio" may have been
>> misleading. The use case we were originally trying to address was
>> "minimum preferred aspect ratio". We didn't use the term "minimum"
>> because we thought it might be confusing, but that's kinda what it  
>> was
>> supposed to be.
>>
>> Our use case was this: we want push buttons in a dialog to be a
>> consistent (minimum) width. If they exceed that width, that's OK -  
>> but
>> we want them to at least *try* to be the same size.
>>
>> My recent change would break that behavior if the button data (e.g.
>> text) required more space than the aspect ratio allowed. So I  
>> actually
>> think I need to revert it, and probably rename the style to
>> "minimumPreferredAspectRatio".
>>
>> G
>>
>> On Aug 6, 2009, at 11:13 PM, Scott Lanham wrote:
>>> 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/apach
>>>> e/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.
>>>
>>> <applicationUi.xml>
>


Mime
View raw message