在我的应用程序中,我在HBox中使用了一个画布和转发器,它是动态的,...现在我想保持一个horizontal scrollbar
,我可能会在Hbox和转发器中显示超过50个画布地址
这是我的代码:
<mx:HBox id="addrBox" x="42" y="161" width="1000%" styleName="ContextPanel" resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15">
<mx:Repeater id="rpt" maxWidth="1000" dataProvider="{ customerAddress }" >
<mx:Canvas height="243" width="283" id="addressCanv" cornerRadius="0" styleName="ContextPanel">
<mx:Label id="seq" text="{rpt.currentIndex+1 }" x="99" y="0"/>
<mx:TextInput id="address1" maxChars="50" change="address1_changeHandler(event)" text="{ rpt.currentItem.addressOne}" x="99" y="60"/>
<mx:TextInput id="address2" maxChars="50" change="address2_changeHandler(event)" text="{ rpt.currentItem.addressTwo}" x="99" y="90"/>
<mx:TextInput id="address3" maxChars="50" change="address3_changeHandler(event)" text="{ rpt.currentItem.addressThree}" x="99" y="120"/>
<mx:TextInput id="postalCd" restrict="[0-9]" maxChars="6" change="postalCd_changeHandler(event)" text="{ rpt.currentItem.postalCode}" x="99" y="150" width="167"/>
<mx:ComboBox id="cntryCdCmb" prompt="Select" change="cntryCdCmb_changeHandler(event)" selectedIndex="{ StaticDataHolder.countryList.getItemIndex(ASUtil.getValue(StaticDataHolder.countryList,rpt.currentItem.countryCode))}" dataProvider="{ StaticDataHolder.countryList }" x="99" y="180" width="167"/>
<mx:CheckBox id="primaryFlag" label="isPrimary" selected="{ (rpt.currentItem.primaryFlag == 0)?true:false }" change="primaryFlag_changeHandler(event)" x="19" y="210"/>
<mx:Label x="10" y="0" text="Seq No"/>
<mx:Label x="10" y="62" text="Address 1"/>
<mx:Label x="10" y="92" text="Address 2"/>
<mx:Label x="10" y="122" text="Address 3"/>
<mx:Label x="10" y="152" text="Postal Code"/>
<mx:Label x="10" y="182" text="Country Code"/>
<mx:Label x="10" y="29" text="Address Type"/>
<mx:ComboBox x="99" y="29" width="167" prompt="Select" change="addTypeCmb_changeHandler(event)" id="addTypeCmb" selectedIndex="{ StaticDataHolder.addressTypes.getItemIndex(ASUtil.getValue(StaticDataHolder.addressTypes,rpt.currentItem.addressType))}" dataProvider="{ StaticDataHolder.addressTypes }"></mx:ComboBox>
<mx:Label x="235" y="210" text="{ rpt.currentItem.primaryFlag}"/>
<mx:Image id="delAddr" x="258" y="3" height="21" width="17" source="images/delete2.png" maintainAspectRatio="true" click="delAddr_clickHandler(event)"/>
</mx:Canvas>
</mx:Repeater>
</mx:HBox>
请为中继器获取水平滚动条提供一些想法。
答案 0 :(得分:1)
在HBox
horizontalScrollPolicy
添加一个属性<mx:HBox id="addrBox" x="42" y="161" width="100%" styleName="ContextPanel"
resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15" horizontalScrollPolicy="on">
on
您可以设置值off
,auto
和auto
。使用{{1}}
如果内容不适合给定空间,则HScrollBar将可见。
答案 1 :(得分:1)
<mx:HBox id="addrBox" x="42" y="161" width="100%" styleName="ContextPanel"
resizeEffect="resize" horizontalGap="5" height="0" paddingLeft="15" horizontalScrollPolicy="auto">
horizontalScrollPolicy auto如果从50减少,则会得到最佳结果。