This is a multi-part message in MIME format.
Hello Sebastian,
Damn! i forgot to attach the patch :P
Here it goes...
Cut from here (for those who cant get the patch as attachment)
------------------------------------------------------------------------------
Index: managers/QxSelectionManager.js
==================================================================--- 
managers/QxSelectionManager.js    (revision 2724)
+++ managers/QxSelectionManager.js      (working copy)
@@ -394,11 +394,54 @@



+/*
+  new Getters/Setters
+*/

+proto.getSelectedIndex = function() {
+    if (this.getSelectedItem() == null)
+    {
+        return -1;
+    }

+    var items = this.getItems();
+    var i;
+    for (i = 0; i < items.length; i++)
+    {
+        if (items[i] == this.getSelectedItem())
+        {
+            items = null;
+            return i;
+        }
+    }
+    items = null;
+    return -1;
+};

+proto.setSelectedIndex = function(index)
+{
+    if (index < 0) {
+        this.setSelectedItem(null);
+        return null;
+    };

+    var items = this.getItems();
+    if (items.length == 0) {
+        this.setSelectedItem(null);
+        return null;
+    };

+    if (index > items.length - 1) {
+        index = items.length - 1;
+    };
+
+    this.setSelectedItem(items[index]);
+    return items[index];
+};
+
+
+
+
 /*!
   Get the selected items (objects)
 */
Index: widgets/QxListView.js
==================================================================--- 
widgets/QxListView.js     (revision 2724)
+++ widgets/QxListView.js       (working copy)
@@ -193,6 +193,20 @@
   this._scrollContent.setHeight((this._data.length * this._pane._rowHeight) + 
this._pane._rowHeight);
 };

+/*
+    New Getters/Setters.
+    Actually just wrap functionality in QxSelectionManager.
+*/
+
+proto.getSelectedIndex = function() {
+    return this._pane.getManager().getSelectedIndex();
+};
+
+proto.setSelectedIndex = function(index) {
+    return this._pane.getManager().setSelectedIndex(index);
+};
+
+
 /*!
   Bugfix for gecko 1.8 (the one released with firefox 1.5)
   Overflow updates if content gets smaller are problematic
--------------------------------------------------------------------------
Ends on the line below

Attachment: set_getSelectedIndex.patch
Description: Binary data

Reply via email to