ui.Combobox.RemoveItem() deletes an option from the combo box.
Syntax
CALL <cmb_var>.RemoveItem("value")
Arguments
value |
value of the combo box option. Can be STRING, INTEGER, BOOLEAN, or other depending on its type. |
Usage and examples
Takes one argument - the value of the combo box option:
CALL cmb.RemoveItem("value3")
.fm2 form: |
|
before removeItem() |
|
after removeItem() |
|
This argument can be STRING, INTEGER, BOOLEAN, or other depending on its type (see example program, ui.ComboBox.RemoveItem_01):
CALL cmb.RemoveItem("one")
CALL cmb.RemoveItem(2)
CALL cmb.RemoveItem(TRUE)
By default, it is STRING because in .fm2, the default value type is StringLiteral.
If you have several combo box options with the same value, ui.Combobox.RemoveItem()
will remove these options one by one starting from the first option added to the .fm2 form:
.fm2 form: |
|
before removeItem() |
|
after removeItem() |
|
You can pass a variable as an argument for ui.Combobox.RemoveItem() - for example, in order to select an option for removing at runtime (see example program, ui.ComboBox.RemoveItem_03_remove_definite):
LET remVal = fgl_winprompt(5, 3, "Type the option's value to remove the option (Example: value3)", "", 25, 0)
IF remVal IS NOT NULL THEN
CALL cmb.RemoveItem(remVal)
END IF
You use ui.Combobox.RemoveItem() with loops or other statements that take INTEGER parameters only if the value of the combo box option is INTEGER (see example program, ui.ComboBox.RemoveItem_02_for):
LET n = cmb.GetItemCount()
FOR i = 1 TO n
CALL cmb.RemoveItem(i)
END FOR
This example will work only if values of the combo box options are IntegerLiteral:
<ComboBoxItem text="item1" identifier="f1_1">
<ComboBoxItem.value>
<IntegerLiteral integerValue="1"/>
</ComboBoxItem.value>
</ComboBoxItem>