PDA

View Full Version : Question about dynamic combo box population



rmilmine
April 28th, 2020, 21:51
I have 2 combo boxes.
The first one contains a simple list.
What I want to do is populate the second combo box based upon the selection of the first combo box.
Is there an onChange function I can script in the first combo box and if so, what's it called and can I access the second combo box to add the item to it in this function?

I've seen examples of using onInit to add items to a combo box dynamically. I just can't seem to find an example of what I want to do.

Thanks.

superteddy57
April 29th, 2020, 02:33
I dont believe there are too many combo box examples. Its not used very often. I really like them. The secret lies in combobox.lua. The addItem or addItems functions fill the combo box. All the tools are in its lua file.

rmilmine
April 29th, 2020, 02:50
Actually I found what I was looking for.
onValueChanged() is called when the value of the combo box is changed and then it's just a case of getting the value selected and populating the other combo box based on the value.