API version 1

- ‐

RW

integer

value

現在選択されているリスト項目の配列番号です。

-1は非選択状態を示します。

selectionModeプロパティがMODE_MULTIの場合は複数の項目を選択できますが、この場合はvalueプロパティの値は最後に選択した項目の配列番号となります。

関連項目

ListItem.selected プロパティ



使用例 CRSダウンロード

Form ListBox_use {
   x = 0;
   y = 0;
   width = 609;
   height = 481;

   ComboBox ComboBox11 {
           x = 30;
           y = 20;
           width = 120;
           height = 24;

           ComboItem ComboItem11[3] {
                   ComboItem11[0].title = "DROP_FILE";
                   ComboItem11[1].title = "DROP_STRING";
                   ComboItem11[2].title = "DROP_OBJECT";
           }

           Function OnTouch(e) {
                   if(^.ComboBox11.value == "DROP_FILE") {
                           ^.ListBox11.acceptDrop = DROP_FILE;
                   }
                   else if (^.ComboBox11.value == "DROP_STRING") {
                           ^.ListBox11.acceptDrop = DROP_STRING;
                   }
                   else if (^.ComboBox11.value == "DROP_OBJECT") {
                           ^.ListBox11.acceptDrop = DROP_OBJECT;
                   }
           }
   }

   ListBox ListBox11 {
           x = 30;
           y = 100;
           width = 128;
           height = 175;
           acceptDrop = DROP_FILE;
           selectionBgColor = "CYAN" ;
           selectionFgColor = "RED" ;

           ListItem ListItem11[4] {
                   ListItem11[0].title = "AAA111";
                   ListItem11[1].title = "BBB222";
                   ListItem11[2].title = "CCC333";
                   ListItem11[3].title = "DDD444"; }

           Function OnDropped(e) {
                   if(e.type == DROP_FILE) {
                           ^.EditBox12.value = e.Data.Read();
                           ListItem11.insert();
                           ListItem11[ListItem11.length - 1].title = e.Data.PathName;
                   }
                   else if(e.type == DROP_STRING) {
                           ^.EditBox12.value = e.Data;
                           ListItem11.insert();
                           ListItem11[ListItem11.length - 1].title = e.Data;
                   }
                   else if(e.type == DROP_OBJECT) {
                           ^.EditBox12.value = e.Data.value;
                           ListItem11.insert();
                           ListItem11[ListItem11.length-1].Title = e.Data;
                   }

                   ^.EditBox13.value = e.dropItem.title;   /* 例:AAA333にDropした場合、AAA333と表示 */

                   if(e.dropItemPosition == DROP_ON_ITEM) {
                           ^.EditBox14.value = "DROP_ON_ITEM";
                   }
           }
   }

   EditBox EditBox12 {
           x = 180;
           y = 29;
           width = 200;
           height = 80;
           Border = BORDER_SUNKEN;
   }

   EditBox EditBox13 {
           x = 180;
           y = 130;
           width = 200;
           height = 80;
           Border = BORDER_SUNKEN;
   }

   EditBox EditBox14 {
           x = 180;
           y = 235;
           width = 200;
           height = 80;
           Border = BORDER_SUNKEN;
   }

   TextBox TextBox12 {
           x = 430;
           y = 56;
           width = 128;
           height = 32;
           Value = "TextBox-object";

           Function OnClicked( e ) {
            var ds = new DragSource;
            ds.SetObject(TextBox12);
            ds.DoDragDrop();
           }
   }

   Label Label1 {
           x = 180;
           y = 13;
           width = 200;
           height = 17;
           Value = "e.data(入力内容)";
   }

   Label Label2 {
           x = 180;
           y = 114;
           width = 200;
           height = 17;
           Value = "e.dropItem(場所)";
   }

   Label Label3 {
           x = 180;
           y = 219;
           width = 200;
           height = 17;
           Value = "e.dropItemPosition(イベント)";
   }
           Label Label5 {
           x = 30;
           y = 60;
           width = 133;
           height = 24;
           Value = "ドラッグの方法を選択して \r\n 下のボックスへドロップ";
   }

   ListBox ListBox4 {
           x = 430;
           y = 120;
           Width = 100;
           height = 81;
           this.SelectionMode = MODE_MULTI;

           ListItem obj1[4] {
                   try {
                           for (var i = 0; i < 4; i++) {
                                   this[i].title = "item[" + str(i) + "-obj]";
                                   this[i].value = i;
                           }
                           this[2].Selected = true;
                           this[1].Selected = true;
                   } catch (e) {
                           ^.messageBox("Message=" + str(e.Message) + "\r\nCategory=" + str(e.Category) + "\r\nCode="+ str(e.Code)  + "\r\nSubCode=" + str(e.subCode));
                   }
           }
   }
   OptionButton optDragMode {
           x = 430;
           y = 210;
           width = 92;
           height = 49;
           OptionItem Item[2] {
                   Height = 20;
                   Width = 60;
                   this[0].Title = "false";
                   this[1].Title = "true";

                   y = 2;
                   x = 10;
                   Function OnTouch( e ) {
                           if (^.^.optDragMode.value) {
                                   ^.^.ListBox4.dragEnabled = true;
                           } else {
                                   ^.^.ListBox4.dragEnabled = false;
                           }
                   }
           }
           Value = 0;
   }
}