Page 1 of 1

Dynamically update listbox?

Posted: November 15th, 2006, 2:56 pm
by cob906
Is it possible to dynamically update a listbox in a dialog window?

Normally, you can do something like this: windowObject.value = "Whatever";

Is there a way to change the values a listbox shows? I've been googling for hours and I haven't found anything. I've tried things like:

Code: Select all

theListBoxObject.children = ["Selection 1", "Selection 2"];
and

Code: Select all

theListBoxObject.items = ["Selection 1", "Selection 2"];
I sure hope this is a possibility. Help? Please! Someone help! :D

Changing listbox items

Posted: November 16th, 2006, 9:44 pm
by redefinery
Hi cob906,

A listbox's items attribute is an array, so if you want to modify a single entry, just reference it as you do any array entry by access its text value (e.g., theListBoxObject.items[0].text = "my new value";). If you need to add/remove items, you can use the .removeAll() and .add("item", "value") methods. An example of the latter is available in my rd: Marker Navigator script (http://www.redefinery.com/ae/view.php?i ... rNavigator).

For more information on listbox items, refer to the Bridge JavaScript reference doc.

Hope this helps.

Jeff

Thanks!

Posted: November 16th, 2006, 10:08 pm
by cob906
I do believe you rock my face off. Thanks a bunch for this! I am unable to try it right now, but I will when I get a chance.

CoB