Listbox Selected Value

I am developing a program to narrow down a selection of countries/cities/areas etc. And am doing this through listboxes. I want to design a new property that uses the selectedIndex to get the selected value or text.

Any suggestions? This is my current code.
[code] import fpmi
data=fpmi.db.toPyDataSet(event.source.parent.getComponent(‘StartLst’).data)

for item in data:
	if count==event.source.parent.getComponent('StartLst').selectedIndex:
		Root Container.StartLst.SelectedText=item[/code]

You should not be writing a script for this. What you want to do is a databinding. Try binding your SelectedText property to an expression binding like this:

if({Root Container.StartLst.selectedIndex} = -1, "-- n/a --", // Text for when nothing is selected {Root Container.StartLst.data}[{Root Container.StartLst.selectedIndex}, 0])

You might want to watch the PBE (properties, bindings, and expressions) series of training videos.