Thread Rating:
  • 446 Vote(s) - 2.92 Average
  • 1
  • 2
  • 3
  • 4
  • 5
複合コントロールのコンストラクタ
05-13-2013, 04:21 PM, (This post was last modified: 05-13-2013, 04:38 PM by nmyzk.)
#2
RE: 複合コントロールのコンストラクタ
こんな感じですか?

ClassType.get-optionで受け取れる引数をハンドリングして
それぞれのコンテンツに渡すイメージです。

渡すべきオプションや渡すべきでないオプションもあると思うので
その辺は適宜調整という感じで。
Code:
{curl 8.0 applet}{curl-file-attributes character-encoding = "utf8"}
{define-class public MultiControlField {inherits HBox}
  {constructor public {default                          ...                      } let (tf-args:Arguments,cb-args:Arguments,self-args:Arguments) = {self.separate-arguments {splice ...}}
    {construct-super {TextField {splice tf-args}}, {CommandButton {splice cb-args}}, {splice self-args}  }

  }
  {method private {separate-arguments                      ...                  }:(tf-args:Arguments,cb-args:Arguments,self-args:Arguments)

let tf-type:ClassType = TextField let cb-type:ClassType = CommandButton let self-type:ClassType = {type-of self} asa ClassType

     let (tf-args:Arguments,cb-args:Arguments,self-args:Arguments) = ({Arguments},{Arguments},{Arguments})

     ||///  ||1.何れか1つに振り分ける  ||/// {for (value:any,name:#String) in ... do
        {if-non-null name         then {if-non-null {tf-type.get-option name}             then {tf-args.append value,keyword = name} {continue} }

{if-non-null {cb-type.get-option name}             then {cb-args.append value,keyword = name} {continue} }

{if-non-null {self-type.get-option name} then {self-args.append value,keyword = name} }
         else {self-args.append value} }

    }
||++||///||++||2.引き受ける引数は全て振り分ける||++||///||++{for  (value:any,name:#String) in ... do||++||++    {if-non-null name||++     then||++        {if-non-null {tf-type.get-option name}||++         then||++            {tf-args.append value,keyword = name}||++        }||++||++        {if-non-null {cb-type.get-option name}||++         then||++            {cb-args.append value,keyword = name}||++        }||++||++||++ {self-args.append value,keyword = name}||++||++||++     else||++        {tf-args.append value}||++        {cb-args.append value}||++        {self-args.append value}||++    }||++||++||++}
    {return tf-args,cb-args,self-args}  }
}

{MultiControlField    editable? = false,    show-focus? = false}


Attached Files
.curl   SeparateArgs.curl (Size: 2.36 KB / Downloads: 587)


Messages In This Thread
RE: 複合コントロールのコンストラクタ - by nmyzk - 05-13-2013, 04:21 PM
Forum Jump:


Users browsing this thread:
1 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('883')