Curl Global Community

Full Version: テキストフィールドの値の初期化
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
テキストフィールドの値を初期化したいと思ったら、どうすればよいですか?

unset マクロを使おうと思ったのですが、 TextField.value はオプションではないのでできませんでした。

空文字をセットする方法も考えましたが、prompt を利用するため、
「初期化された状態」=「プロンプトが表示された状態」になってほしいです。
TextField.unset-value メソッドを利用すればよいですね。]

Code:
{def tf = {TextField prompt = "<初期状態です>"}}
{value tf}
{CommandButton
    label = "初期化されているか?",
    {on Action do
        {if tf.has-value? then
            {popup-message {VBox "入力済み", "値:" & tf.value}}
         else
            {popup-message "初期化されています"}
        }
    }
}
{CommandButton
    label = "テキストフィールドの初期化",
    {on Action do
        {tf.unset-value }
    }
}