5 Replies Latest reply on Apr 28, 2010 8:59 AM by -skitch-

    ButtonBar with no selection

    Zolotoj Level 3

      How can I make this control with no initial selection? I am using Flex 4.



        • 1. Re: ButtonBar with no selection
          Peter deHaan Level 4

          Are you using a Spark ButtonBar or MX ButtonBar control?

          I wasnt seeing a selection on either control with the following example:


          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
              <s:ButtonBar id="btnBar" horizontalCenter="0" verticalCenter="0">
                      <s:ArrayList source="[Red,Orange,Yellow,Green,Blue]" />




          • 2. Re: ButtonBar with no selection
            Zolotoj Level 3

            This is my code:

            <s:ButtonBar id="tasks" requireSelection="true"> 
                 <s:VerticalLayout gap="1"/>
                 <s:ArrayCollection source="['Sewing', 'Cutting']" />


            Sewing button is highlighted.

            • 3. Re: ButtonBar with no selection

              since you set RequireSelection = "true", you imply that something has to be selected...but you don't want anything selected on the initial view?


              You could always try something like changing the state of the view to update that posibility:


                      <s:State name="test1"/>
                      <s:State name="test2"/>
                  <s:ButtonBar id="tasks"
                              source="['Sewing', 'Cutting']" />

              1 person found this helpful
              • 4. Re: ButtonBar with no selection
                Zolotoj Level 3

                I have set RequireSelection = "false" and now it comes up with no button selected.

                • 5. Re: ButtonBar with no selection
                  -skitch- Level 1

                  try it with the states...


                  On the initial load you want - RequireSelection = false


                  When one is clicked, you want RequireSelection = true


                  using states, you can change the how a property is set.


                  In my first state, I have requireselection = false

                  Once a click happens, I set the current state = state 2.

                  this makes requireselection = true.