Curl Global Community

Full Version: TextAreaのmaxline?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
TextAreaコントロールを使います。
入力行数が最大 三行欲しいです。でも、このコントロールはmaxline のプロパティが無いです。
どの方法でTextAreaの入力行数を制御できますことがを教えてください。
四行目を入力不可にしてみました。どうでしょうか。
Code:
{let ta = {TextArea
              height = 5cm,
              width = 5cm,
              {on e:ValueChanged at ta:TextArea do
                  let a:int = {ta.value.find '\n'}
                  let count:int = 0
                  let break?:bool = false
                  {while a > -1 do
                      set a = {ta.value.find '\n', starting-index = a + 1}
                      {inc count}
                      {output count}
                      {if count > 2 then
                          set ta.value = ta.user-data
                          set break? = true
                          {break}
                      }
                  }
                  {if not break? then
                      set ta.user-data = ta.value
                  }
              }
          }
}
{value ta}