Dynamically update listbox?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
cob906
Posts: 28
Joined: August 8th, 2006, 3:25 pm
Location: Lewisville, TX
Contact:

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
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

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
cob906
Posts: 28
Joined: August 8th, 2006, 3:25 pm
Location: Lewisville, TX
Contact:

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
Post Reply