Here are the patches against listview, combobox, and tree. It adds getSelectedIndex() and setSelectedIndex() to each.
Included is an HTML document with a sample of each function call.
Here are some issues:
- it seems a bit unorthodox to offer index-based accessors/setters
for a tree, but it was useful to me (for saving and restoring
state of the tree).
- the code does not take into account multi-select in listview.
It just returns the selected index of the first selected item.
Maybe that needs to be expanded to return an array...
- I added documentation to the functions; I hope it shows up properly
in the auto-generated docs. Some of the comments are multi-line.
- I think I found a bug in QxComboBox: until you actually drop down
the combo, this._manager.getItems() returns an empty list. Once you
have dropped down the combo, you get a non-empty list (you don't
even
have to make a selection in the combo -- just drop it down and close
it).
To replicate, just open my sample HTML, and push "Set Selected"
under
the combo box. It won't work. Now drop down the combo, and close
the combo. Now push "Set Selected". It will work.
Jason Priebe
CBC New Media
Qx_selectedindex.patch
Description: Qx_selectedindex.patch
