簡體   English   中英

我想強制用戶僅使用箭頭來編輯NumericStepper的值,以使他們無法直接在value字段中輸入值

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM