API version 1

- ‐

R

integer

index

配列要素の位置(添え字)を表します。 このプロパティは個々の配列要素に対して付加されます。配列オブジェクトには付加されないことに注意してください。

Number num[3];
messageBox(num[1].index); /* この行で1が表示されます */
messageBox(num.index);    /* この行はエラーです。配列オブジェクトにはIndexは付加されません */

関連項目

isArraylength プロパティ



使用例 CRSダウンロード ダウンロード(Dialog12.crs)

Form Objcntl {
   x = 0;
   y = 0;
   width = 800;
   height = 600;
   TextBox textbox1 {
           x = 100;
           y = 120;
           width = 168;
           height = 48;
   }
   Button button1 {
           x = 100;
           y = 200;
           width = 160;
           height = 48;
           Title = "ユーザー定義イベントを\r\n発生させる" ;

           function onTouch(e) {
                   var eventname = "UserEvent";
                   var userEvent1 =
                           new Event(eventname)  {
                                   String data ;
                           }
                   userEvent1.data.Value = ^.TextBox1.Value;
                   PostEvent(userEvent1) ;
           }
   }

   function OnUserEvent(e) {
           //.MessageBox(e.data.Value) ;
           print("from = ",e.from) ;

           var child = new Number[5];
           child[0] = 5;
           child[1] = 4;
           child[2] = 3;
           child[3] = 2;
           child[4] = 1;
           append(child, "TheArray");
           print("clasName=",child.className) ;
           print("array=",child.isArray," inx= ",child.index," Len= ",child.length);
           print("name=",child.name);
           print("type=",child.subType);
           print("change=",child.useChange);

           var fun = findObject("TheArray", FIND_EVENTPATH);
           if (fun == null) { print("null return") ; } ;
           print("find=",fun);
           for (var i in child) {
                   print(" indx=",i, " value=",child[i].value, "\n");
           }
           child.insert( 0 ) ;
           var ca = getChildObjects();
           for (var j in ca) {
                   if (ca[j] != null) {
                           print("inx= ", j, " value= ",ca[j].value ) ;
                   }
           }
           //.get("dialog12.crs");
           /* child.truncate() ; #このサンプルでは使えません */
   }
}