0

hello i have this buttonbar:

<s:ButtonBar id="channelsBtnBar" requireSelection="true" width="100%" horizontalCenter="0"
                     skinClass="skins.TvButtonBarSkin"
                     change="channelsBtnBar_changeHandler(event)"> 
            <s:dataProvider>
                <s:ArrayList>
                    <fx:Object icon="@Embed('assets/ch1.png')"/>
                    <fx:Object icon="@Embed('assets/ch2.png')"/>
                    <fx:Object icon="@Embed('assets/ch3.png')"/>
                    <fx:Object icon="@Embed('assets/ch4.png')"/>
                    <fx:Object icon="@Embed('assets/ch5.png')"/>
                    <fx:Object icon="@Embed('assets/ch6.png')"/>
                    <fx:Object icon="@Embed('assets/ch7.png')"/>
                    <fx:Object icon="@Embed('assets/ch8.png')"/>
                    <fx:Object icon="@Embed('assets/ch9.png')"/>
                </s:ArrayList>
            </s:dataProvider>

</s:ButtonBar>

how can i have in creationcomplete of the parent component any of the items selected? is this possible without setting requireSelection to false and selectedItem to -1?

zero323
  • 322,348
  • 103
  • 959
  • 935
sstauross
  • 2,602
  • 2
  • 30
  • 50
  • I don't understand what you want to do. Do you want to default the buttonBar to a "nothing selected" state? – JeffryHouser Apr 26 '12 at 02:16
  • yes exactly but with requireSelection="true"... if i set selectedItem="-1" does not work..any idea? – sstauross Apr 26 '12 at 10:02
  • Isn't that expected behaviour? If you want to require a selection, why would you be able to put it in the "nothing selected" state? – JeffryHouser Apr 26 '12 at 13:03
  • before the user clicks anywhere on the buttonbar i want nothing selected but this behaviour to start at the first click..i think i solved it right know..should i change the property to true at the first click?:) – sstauross Apr 26 '12 at 14:53
  • That seems reasonable. Swap the property on first click. – JeffryHouser Apr 26 '12 at 15:11

2 Answers2

1

Swap the property requireSelection to "true" on first click!

sstauross
  • 2,602
  • 2
  • 30
  • 50
0

Use selectedIndex property of ButtonBar.

if you want to select any item use selectedIndex="2" where as 2 is your selected index of ButtonBar. If you do not want to select any thing use selectedIndex="-1".

Hope this may help....

Mahesh Parate
  • 786
  • 1
  • 4
  • 13
  • FYI, "requireSelection" Property Description: - If true, a data item must always be selected in the control. If the value is true, the selectedIndex property is always set to a value between 0 and (dataProvider.length - 1). The default value is false for most subclasses, except TabBar. In that case, the default is true. – Mahesh Parate Apr 26 '12 at 11:27