Binding to an unbindable property

I’m trying to create a text label that shows which index is selected based on a dropdown list. The data in the dropdown list is dynamically populated. If there are 4 possible options and I have the first selected, I’d like the label to read 1 of 4 selected.

I want to bind to the selectedIndex property of a dropdown list. I know that this value was hidden from binding because too many users were getting it confused when they actually wanted selectedValue.

Is there some way that I can achieve this effect with Jython?

Yes, you can still access the selectedIndex property from Jython. You could make your own selectedIndex property as follows:

[ol]
[li]Put an integer dynamic property on your dropdown called idx.[/li]
[li]Put the following script on your dropdown for the propertyChange event:

if event.propertyName == 'selectedIndex': event.source.setPropertyValue('idx',event.newValue)[/li][/ol]

Now you can use your dropdown box’s idx property in your “x of 4 selected” label’s expression binding.

Hope this helps,