繁体   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