ui.ComboBox methods are used to manipulate ui.ComboBox objects at runtime.
To manipulate ui.ComboBox objects, you have to:
declare the ui.ComboBox object with a DEFINE statement:
DEFINE cbx_object ui.ComboBox
initialize the ui.ComboBox object:
LET cbx_object = ui.ComboBox.forName("my_combobox")
There are two groups of methods available for combo boxes - methods that allow changing the content of a combo box and methods that allow changing its properties.
Methods for changing the content of a combo box
creates an object of ui.ComboBox class: LET cmb = ui.ComboBox.Create("f1") |
|
initializes the object of ui.ComboBox class: LET cmb = ui.ComboBox.ForName("f1") |
|
adds a new option to the combo box: CALL cmb.AddItem("added","new") CALL cmb.AddItem(option_value,option_text) |
|
deletes an option from the combo box: CALL cmb.RemoveItem("value") CALL cmb.RemoveItem(remove_option) |
|
removes all the options from the combo box: CALL cmb.Clear() |
|
returns the number of options in the combo box: DISPLAY cmb.GetItemCount() |
|
returns the value of the combo box option: DISPLAY cmb.GetItemName(4) DISPLAY cmb.GetItemName(input_var) |
|
returns the text of the combo box option: DISPLAY cmb.GetItemText(4) DISPLAY cmb.GetItemText(input_var) |
|
returns the text of the combo box option: DISPLAY cmb.GetTextOf("value") DISPLAY cmb.GetTextOf(value_var) |
|
returns the index of the combo box option: DISPLAY cmb.GetIndexOf("value") DISPLAY cmb.GetIndexOf(value_var) |
|
getTag() |
returns the identifier of the combo box |
specifies the default function that will initialize every ui.ComboBox object newly created by the 4gl application: CALL ui.ComboBox.setDefaultInitializer("init_func") |
Methods for changing the properties of a combo box
specifies whether input must move to the next field after the value specified for maxLength is reached: CALL cmb.setAutonext(1) CALL cmb.setAutonext(TRUE) |
|
getAutonext() |
returns the value of the autonext property or the setAutonext() method |
setEditable() |
specifies whether you can select an option by typing its text directly to the text field of a combo box: CALL cmb.setEditable(0) CALL cmb.setEditable(FALSE) |
getEditable() |
returns whether you can select an option by typing its text directly to the text field of a combo box |
specifies the maximum length in bytes for string input to an editable combo box: CALL cmb.setMaxLength(10) |
|
getMaxLength() |
returns the maximum length in bytes for string input to an editable combo box |
setRequired() |
forces the user to enter data in the combo box during the INPUT statement (= it cannot be left empty): CALL cmb.setRequired(1) CALL cmb.setRequired(TRUE) |
getRequired() |
returns whether the user is forced to enter data in the combo box during the INPUT statement |
specifies the case of a text input to the combo box: CALL cmb.setToCase("up") |
|
getToCase() |
returns the case of a text input to the combo box |
setHelperText() |
sets the helper text for the combo box (material design): CALL cmb.SetHelperText("helperText") |
getHelperText() |
returns the helper text for the combo box (material design): |
setLabelText() |
sets the label text for the combo box (material design): CALL cmb.SetLabelText("labelText") |
getLabelText() |
returns the label text for the combo box (material design) |