List Widget



 List Widget is an object that displaying various items as a list in the widget.


                                         




Methods




Return Type

Method

Description

 

addItem( text )

Add an item to the list.

 

addItems( texts )

Add items to the list.


clear()

Remove all items of the list.

int

count()

Obtain the number of all items in the list.

int

currentIndex()

Obtain the index of the currently selected item in the list.

str

currentText()

Obtain the String of the currently selected item in the list.

 

insertItem( index, text )

Insert an item to the list.

 

insertItems( index, texts )

Insert items to the list.

str

itemText( index )

Obtain the String of the selected item in the list.

 

removeItem( index )

Remove the selected item in the list.


removeItem( text )

Remove the selected item in the list.

 

setCurrentIndex( index )

Set the selected item in the list.



  addItem( text:String )

 

  addItem enters the String to the list.


        ㆍ It enters from index 0 and increments by 1.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       obj.addItem('1111');

       obj.addItem('2222');

       obj.addItem('3333');


   



                                         



  addItems( texts:String list )

 

  addItems enters the String list to a list in regular order.


        ㆍ It is entered from index 0 and the index increments by the number of items the list had.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '4444', '5555', '6666' ];

       obj.addItems(textList);


   



                                         



  insertItem( index:Enter point, text:String )

 

  insertItem is used to insert the String in the middle.


        ㆍ Enter the String to index as a list.

        ㆍ The existing index increments by 1.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       obj. addItem('1111');

       obj. addItem('2222');

       obj. addItem('3333');

       obj.insertItem(1, 'abcd');  << Insert abcd to the first position(2222).


   



                                         



  insertItems( index:Enter point, texts:String list )

 

  insertItems is used to insert the String to the middle.


        ㆍ Enter the String list to the list at index.

        ㆍ It enters the number of String lists in regular order.

        ㆍ The existing index increments by the number of String lists.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       obj. addItem('1111');

       obj. addItem('2222');

       obj. addItem('3333');

       textList = [ '4444', '5555', '6666' ];

       obj.insertItems(1, textList);  << Insert textList(three items) to the first position(2222).


   



                                         



  int count()

 

  count returns the number of items that registered to the list widget.


        ㆍ Result is returned as Numeric.

        ㆍ Increments by the number of lists.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333' ];

       obj. addItems(textList);

       value = obj.count();

       app.messageBox(value);


   



                                         



  clear()

 

  clear removes the information of all items registered to the widget.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333' ];

       obj. addItems(textList);

       obj.clear();

   




                                         



  removeItem( index:Item position )

 

  removeItem removes the item at the index position in the list widget.


        ㆍ index starts from 0.

        ㆍ After remove, the index is decreased by 1.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       obj.removeItem(1);  << Delete 2222 at index 1.


   



                                         



  removeItem( text:String )

 

  removeItem removes the String which is the same as the text in the list widget.

 

        ㆍ If the duplicated String exists, delete the first one.

        ㆍ After remove, the index is decreased by 1.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       obj.removeItem(‘3333’);  << Delete 3333 which is the same as 3333 at the index 2.


   



                                         



  str itemText( index:Item oposition )

 

  itemText obtains the String of the list at the index position in the list widget.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       text = obj.itemText(0);

       app.messageBox(text);

   




                                         



  int currentIndex()

 

  currentIndex returns the value that the index of the currently selected item in the list widget.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       value = obj.currentIndex();  << Obtain the currently selected index.

       app.messageBox(value);


   



                                         



  str currentText()

 

  currentText returns the String of the currently selected item in the list widget.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       value = obj.currentText();  << Obtain the String of the currently selected object.

       app.messageBox(value);


   



                                         



  setCurrentIndex( index:Item position )

 

  setCurrentIndex set the selection point of list widgets as the index user-defined.


        ㆍ If setCurrentIndex is not used, nothing selected at first drive.

        ㆍ If setCurrentIndex is used, the selection is displayed.



  Example)

   


       obj = canvas.getObject('ListWidget');  << Obtain the list widget object.

       textList = [ '1111', '2222', '3333', '4444', '5555' ];

       obj. addItems(textList);

       obj.setCurrentIndex(0);  << Display the selection at the 0th position.