List Widget
List Widget
List Widget is an object that displaying various items as a list in the widget.
Methods
Return Type |
Method |
Description |
|
Add an item to the list. |
|
|
Add items to the list. |
|
Remove all items of the list. |
||
int |
Obtain the number of all items in the list. |
|
int |
Obtain the index of the currently selected item in the list. |
|
str |
Obtain the String of the currently selected item in the list. |
|
|
Insert an item to the list. |
|
|
Insert items to the list. |
|
str |
Obtain the String of the selected item in the list. |
|
|
Remove the selected item in the list. |
|
Remove the selected item in the list. |
||
|
Set the selected item in the list. |
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 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 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 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).
|
|
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 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 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 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.
|
|
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);
|
|
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);
|
|
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 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.
|
|