Issue in setting 'allowDeselction' property of ButtonBarButton component
i have tabs individual buttons spacing between each button. should function normal tab navigator tabs.
so, took spark buttonbar component , made changes buttonbarskin said above. default behavior of buttonbar 1 button in buttonbar control can in selected state. means when select button in buttonbar control, button stays in selected state until select different button.
but, if click on selected button, selection goes off. don't need such behavior. want button in selected state if click again in tab bar control.
while explored buttonbarskin, got know buttonbarbutton being used defining custom item renderer buttonbar control. buttonbarbutton component has "allowdeselection"property default true means selected button in buttonbar can deselected clicking again. if set false,the user must select different button deselect selected button.
so, while declaring buttonbarbutton component in buttonbarskin, im setting theallowdeselection property false. then, value being set true. while debugging code, thing found weird is, declared value i.e., false set first , again being set true firstbutton, middlebutton , lastbutton of buttonbar. don't know how property getting set true i'm setting false while defining in buttonbarskin.
the code snippet follows :
buttonbar control
<s:buttonbar skinclass="skin.buttonbarskincopy"> <mx:arraycollection> <fx:string>flash</fx:string> <fx:string>director</fx:string> <fx:string>dreamweaver</fx:string> <fx:string>coldfusion</fx:string> </mx:arraycollection> </s:buttonbar>
buttonbarskincopy.mxml
<?xml version="1.0" encoding="utf-8"?> <!-- adobe systems incorporated copyright 2008 adobe systems incorporated rights reserved. notice: adobe permits use, modify, , distribute file in accordance terms of license agreement accompanying it. --> <!--- default skin class spark buttonbar component. buttons on buttonbar component use buttonbarlastbuttonskin, buttonbarfirstbuttonskin , buttonbarmiddlebuttonskin classes. @see spark.components.buttonbar @see spark.components.buttonbarbutton @langversion 3.0 @playerversion flash 10 @playerversion air 1.5 @productversion flex 4 --> <s:skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" alpha.disabled="0.5"> <fx:metadata> <![cdata[ /** * @copy spark.skins.spark.applicationskin#hostcomponent */ [hostcomponent("spark.components.buttonbar")] ]]> </fx:metadata> <s:states> <s:state name="normal" /> <s:state name="disabled" /> </s:states> <fx:declarations> <!--- @copy spark.components.buttonbar#firstbutton @default spark.skins.spark.buttonbarfirstbuttonskin @see spark.skins.spark.buttonbarfirstbuttonskin --> <fx:component id="firstbutton"> <s:buttonbarbutton allowdeselection="false" skinclass="skin.custombuttonbarbuttonskin" /> </fx:component> <!--- @copy spark.components.buttonbar#middlebutton @default spark.skins.spark.buttonbarmiddlebuttonskin @see spark.skins.spark.buttonbarmiddlebuttonskin --> <fx:component id="middlebutton" > <s:buttonbarbutton allowdeselection="false" skinclass="skin.custombuttonbarbuttonskin" /> </fx:component> <!--- @copy spark.components.buttonbar#lastbutton @default spark.skins.spark.buttonbarlastbuttonskin @see spark.skins.spark.buttonbarlastbuttonskin --> <fx:component id="lastbutton" > <s:buttonbarbutton allowdeselection="false" skinclass="skin.custombuttonbarbuttonskin"/> </fx:component> </fx:declarations> <!--- @copy spark.components.skinnabledatacontainer#datagroup --> <s:datagroup id="datagroup" width="100%" height="100%"> <s:layout> <s:buttonbarhorizontallayout gap="2"/> </s:layout> </s:datagroup> </s:skin>
and custombuttonbarbuttonskin.mxml copy of buttonbarbuttonskin. no change done in buttonbarbuttonskin.mxml.
kindly, please share views.
to achieve above, try below fix:
var buttonbar:buttonbar = new buttonbar();
buttonbar.requireselection = true;
hopefully works . cheers!!
More discussions in Flex SDK
adobe
Comments
Post a Comment