[Laszlo-checkins] r13186 - openlaszlo/trunk/lps/components/base

ptw@openlaszlo.org ptw at openlaszlo.org
Thu Mar 5 10:50:52 PST 2009


Author: ptw
Date: 2009-03-05 10:50:51 -0800 (Thu, 05 Mar 2009)
New Revision: 13186

Modified:
   openlaszlo/trunk/lps/components/base/baselist.lzx
Log:
Change 20090305-ptw-g by ptw at dueling-banjos.home on 2009-03-05 09:56:18 EST
    in /Users/ptw/OpenLaszlo/trunk-3
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Make shift-arrow extend list selection

Bugs Fixed: LPP-7768  List range (shift) selection should be similar to other standards

Technical Reviewer: a.bargull at intensis.de,hminsky (pending,Message-ID: <8c61fad60903050938g6a0774c6i555e87919dec0d78 at mail.gmail.com>)
QA Reviewer: antun (pending)

Details:
    Be careful to keep the current item highlited after you may a
    keyboard selection.  If the hilight is lost, restore it to the
    last selected item for keyboard navigation.  If you navigate with
    the arrow key and rangeSelect key, extend the selection.

    NOTE: this does _not_ address LPP-798.  That will be addressed at
    a later date.

Tests:
    Fiddle around with the multi-select list example and be pleased by
    how it works.



Modified: openlaszlo/trunk/lps/components/base/baselist.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baselist.lzx	2009-03-05 17:14:22 UTC (rev 13185)
+++ openlaszlo/trunk/lps/components/base/baselist.lzx	2009-03-05 18:50:51 UTC (rev 13186)
@@ -141,9 +141,22 @@
         <method name="_dokeydown" args="kc">
             <![CDATA[
             /* select item on 'space' key */
-            if (kc == 32 && this._hiliteview is lz.view && this._hiliteview.enabled) {
-               this._hiliteview.setAttribute('selected', true);
-              // this._hiliteview.setHilite(false);
+            var s = this._hiliteview;
+
+            if (s == null) {
+                s = getSelection();
+                // [2009-03-05 ptw] If you lost the highlight because
+                // you extended the selection, you want to pick up from
+                // there
+                if (this.multiselect) s = s[s.length - 1];
+            }
+
+            if (kc == 32) {
+               if (s is lz.view && s.enabled) {
+                 s.setAttribute('selected', true);
+                 // [2009-03-05 ptw] Don't lose the hilite because you selected
+                 s.setHilite(true);
+               }
                return;
             }
 
@@ -153,13 +166,6 @@
             */
             if (kc >= 37 && kc <= 40) {
                 this.setAttribute( 'doesenter', true );
-                var s = this._hiliteview;
-
-                if (s == null) {
-                    s = getSelection();
-                    if (this.multiselect) s = s[0];
-                }
-
                 var next;
                 if (kc == 39  || kc == 40) {
                     next = _selector.getNextSubview(s);
@@ -167,9 +173,13 @@
                 if (kc == 37  || kc == 38) {
                     next = _selector.getNextSubview(s, -1);
                 }
-                if (  this._hiliteview != 0 && this._hiliteview is lz.view  ) {
-                    this._hiliteview.setHilite(false);
+                if ( s is lz.view  ) {
+                    s.setHilite(false);
                 }
+                // If shift is down, extend the selection
+                if (next.enabled && _selector.isRangeSelect(next)) {
+                  next.setAttribute('selected', true);
+                }
                 next.setHilite(true);
                 this._hiliteview = next;
              }



More information about the Laszlo-checkins mailing list