Set Spark button width in ButtonBar

2.2k views Asked by At

How do I set the individual button sizes in a Spark ButtonBar? It used to be something like:

<mx:ButtonBar id="myButtonBar" buttonHeight="12" buttonWidth="250" >

I get an error when I try to do the same in Spark:

Cannot resolve attribute 'buttonHeight' for component type spark.components.ButtonBar

I don't want to create a separate skin...just something that will work inline if possible

2

There are 2 answers

0
Cosma Colanicchia On BEST ANSWER

Just set its layout.

<s:ButtonBar id="myButtonBar">
    <s:layout>
        <s:HorizontalLayout variableColumnWidth="false" gap="0" columnWidth="250"/>
    </s:layout>
</s:ButtonBar>

Many things are just different in Spark :)

1
JeffryHouser On

I see two different ways to approach this.

  1. Create a custom skin class and set the Button Width that way. You'll have to review the existing ButtonBar Skin to figure out specifics.
  2. Extend the button class to set he new button width and use that class to create new factories for the button related skin parts

You could also roll back to the Flex 3 ButtonBar and use the buttonWidth style. Some things are just easier in Halo.