Thread Rating:
  • 698 Vote(s) - 2.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
文字入力の抑止について
09-26-2011, 12:55 PM,
#12
RE: 文字入力の抑止について
Quote:また、tf2をmax-charsの変更だけで同じ挙動をさせたいのですがこの場合はNumericTextFieldのような
拡張クラスを作らなければならないのでしょうか?

クラスを作らずに、同じ定義を部品化したいのであれば
Arguments と splice を使用すればこんな感じでできます。

Code:
{import * from CURL.LANGUAGE.REGEXP}
{let max-chars:int = 5}
{let arg:Arguments = {Arguments
                         {on e:KeyPress  do
                             {tf1.record-typing-for-undo e.value}
                         },
                         {on e:ValueChanged at tf:TextField do
                             {if {regexp-match? |"\D"|, tf.value} then
                                 {tf.undo}
                              else
                                 {tf.clear-undo-stack}
                             }
                             {if {tf.get-text}.size >= tf.max-chars then
                                 let kp:KeyPress = {KeyPress}
                                 set kp.value = KeyPressValue.tab
                                 {tf1.ui-object.enqueue-event
                                     kp
                                 }
                                 {e.consume}
                             }
                         },
                         {on AttachEvent do
                             {tf1.become-active}
                         }}}
{let tf1:TextField =
    {TextField
        width = 40pt,
        max-chars = max-chars,
        {splice  arg}
    }
}
{let tf2:TextField =
    {TextField
        width = 40pt,
        max-chars = 5,
        {splice  arg}
    }
}
{let tf3:TextField =
    {TextField
        width = 40pt,
        max-chars = 4,
        {splice  arg}
    }
}
{let tf4:TextField =
    {TextField
        width = 25pt,
        max-chars = 3,
        {splice  arg}
    }
}
{let tf5:TextField =
    {TextField
        width = 60pt,
        max-chars = 10,
        {splice  arg}
    }
}
{HBox tf1,tf2,tf3,tf4,tf5}


Messages In This Thread
文字入力の抑止について - by usami - 09-16-2011, 10:10 AM
RE: 文字入力の抑止について - by nmyzk - 09-16-2011, 11:54 AM
RE: 文字入力の抑止について - by usami - 09-21-2011, 12:02 PM
RE: 文字入力の抑止について - by usami - 09-22-2011, 09:23 AM
RE: 文字入力の抑止について - by Yuhki - 09-22-2011, 09:50 AM
RE: 文字入力の抑止について - by nmyzk - 09-22-2011, 09:56 AM
RE: 文字入力の抑止について - by usami - 09-22-2011, 01:14 PM
RE: 文字入力の抑止について - by usami - 09-22-2011, 04:00 PM
RE: 文字入力の抑止について - by usami - 09-26-2011, 05:42 PM
RE: 文字入力の抑止について - by fukuta - 09-29-2011, 08:56 AM
RE: 文字入力の抑止について - by onyo - 09-26-2011, 12:55 PM
RE: 文字入力の抑止について - by usami - 09-26-2011, 05:50 PM
RE: 文字入力の抑止について - by fukuta - 09-29-2011, 09:28 AM
RE: 文字入力の抑止について - by usami - 09-29-2011, 02:54 PM
Forum Jump:


Users browsing this thread:
3 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('279')