[英]I want to force the user to edit the value of the NumericStepper by using the arrows only so they cannot type a value directly into the value field
使用NumericStepper時,我想強制用戶只能使用NumericStepper的向上和向下箭頭來編輯值。 我不希望用戶能夠直接輸入一個值。 我如何在Flex 4中做到這一點? 有人可以提供例子嗎?
謝謝
您需要將NumericStepper的textDisplay設置為不可編輯。 組件初始化后即可執行以下操作:
<fx:Script>
<![CDATA[
protected function init():void {
nmStppr.textDisplay.editable = false;
}
]]>
</fx:Script>
<s:NumericStepper id="nmStppr"
horizontalCenter="0" verticalCenter="0"
creationComplete="init();"/>
或按照此處的說明創建自定義皮膚
您可以嘗試另一種方法,以使您無法在NumericStepper中更改該值。 這些值將不可編輯。
<s:NumericStepper id="num"
horizontalCenter="0" verticalCenter="0"
creationComplete="init();"/>
<fx:Script>
<![CDATA[
protected function init():void {
num.mx_internal::inputField.editable=false;
}
]]>
</fx:Script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.