Combo Box
Combo Box
Combo box is a graphic object that displaying items when entering several items, and pressing the extension button of objects.
Combo box is used to display or select one among various items.
Combo box provides the following functions and events.
Methods
Return Type |
Method |
Description |
Add an item to the combo box. |
||
Add items to the combo box. |
||
addItemWithValue( text, value ) |
Add an item to the combo box and set the data. |
|
Clear all items of the combo box. |
||
connect( eventName, func ) |
Register an event handler to find the select is changed. |
|
int |
Obtain the number of combo box items. |
|
int |
Obtain the number of the currently selected item in the combo box. |
|
str |
Obtain the String of the currently selected item in the combo box. |
|
Insert an item to the combo box. |
||
variant |
itemData( index ) |
Read the data of that property. |
str |
Obtain the String of combo box properties. |
|
Remove the property of combo boxes. |
||
variant |
Read the data of the selected property. |
|
Set displaying properties of the combo box. |
||
setCurrentIndexByValue( value ) |
Find and select a property with that value. |
|
setCurrentText( text ) |
Find and select a property with that String. |
|
Modify the String of properties. |
addItem enters the String property to the combo box. ㆍ Enter String to text. ㆍ It enters in ascending order. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. obj.addItem('12345'); << Enter 12345 as 0th item. obj.addItem('67890'); << Enter 67890 as 1st item. |
|
addItems enters a list of String to the combo box. ㆍ Enter a list of String to texts. ㆍ It enters in ascending order. |
Example)
obj = canvas.getObject('CheckBox'); << Obtain the checkbox object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. |
|
insertItem inserts the String at an index point of the combo box. ㆍ Existing items position in incremented by 1. ㆍ Enter String to text. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. obj.insertItem( 2, ‘0000’); << Insert to the second item('aaaa'). Index increments by 1. |
|
setItemText modifies the String at index point to the text. ㆍ index starts from 0 on the top. ㆍ Enter String to text. Enter String to text. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. obj.setItemText( 2, ‘0000’); << Modify to 0000 |
|
removeItem removes after index in the combo box. ㆍ After removing, every index is decreased by 1. |
Example)Rmove the second item('aaaa').
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. obj.removeItem( 2 ); << Remove the second item('aaaa'). |
|
clear removes all items of the combo box. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. obj.clear(); << Remove all items. |
|
count returns the number of properties. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. value = obj.count(); << Enter the number of properties to value. app.messageBox( value ); << Print value. |
|
itemText obtains the String of the property positioning at index. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. value = obj.itemText(0); << Enter String to the oth index item to value. app.messageBox( value ); << Print value. |
|
currentIndex obtains the index number of the selected item in the combo box. ㆍ Combo box displays the item user selected. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. value = obj.currentIndex(); << Enter the current index to value. app.messageBox( value ); << Print value. |
|
currentText obtains the String of the selected item in the combo box. ㆍ Combo box displays the item user selected. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. value = obj.currentText(); << Enter the current text to value. app.messageBox( value ); << Print value. |
|
setCurrentIndex displays the item displayed on the screen as an index item. ㆍ Combo box displays the item of index 0 if it has no setCurrentIndex setting. ㆍ If the user selects by clicking the combo box, the item is displayed. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object. a = ['1111', '2222', 'aaaa', 'bbbb']; << Enter items to a as a list. obj.addItems( a ); << Enter list a. obj.setCurrentIndex(1); << Show the first item. |
|
Add an item to the combo box and set its data. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object.
obj.addItemWithValue('Apple' , 32 ); << Add an Apple to the combo box, and set 32 to Apple. |
Read the data of the currently selected item. Do not read the value if the data does not set. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box.
value = obj.selectedItemData(); |
Read the data of the currently selected item. Do not read the value if the data is not set. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object.
value = obj.itemData(3); # Obtain the third item. |
Find and select the property with that value. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object.
value = obj.setCurrentIndexByValue(32); # Select the item which had 32. |
Find and select the property with that String. |
Example)
obj = canvas.getObject('ComboBox'); << Obtain the combo box object.
value = obj.setCurrentText('Apple'); # Select Apple. |