[Laszlo-checkins] r13016 - in openlaszlo/trunk/lps/components: base lz
bargull@openlaszlo.org
bargull at openlaszlo.org
Mon Feb 23 02:24:45 PST 2009
Author: bargull
Date: 2009-02-23 02:24:41 -0800 (Mon, 23 Feb 2009)
New Revision: 13016
Modified:
openlaszlo/trunk/lps/components/base/baselist.lzx
openlaszlo/trunk/lps/components/base/baselistitem.lzx
openlaszlo/trunk/lps/components/lz/list.lzx
Log:
Change 20090222-bargull-Tq7 by bargull at dell--p4--2-53 on 2009-02-22 23:04:30
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: focus and select issue for lz.list
New Features:
Bugs Fixed: LPP-5159 (bad interaction of "baselistitem#_doMousedown" and "list#_doFocus"), LPP-1322 (List fails to properly select textlistitem after initial load)
Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Whenever lz.list is focused, it'll ensure the current selection is visible by calling "list#ensureItemInView(..)". This may cause a bug, if
the list hasn't got focus and a user scrolls down the list (using the scrollbar does not give focus to the list!), because if a user now wan
ts to select a list-entry by clicking on it, the list gets focus and "ensureItemInView" will be called => list jumps back to the current se
lection (this is not the item the user clicked on, selection will actually happen at a later time).
To stop this behaviour, I've introduced a new flag on baselist ("__focusfromchild"), so it's possible to detect when a list-item set focus, in which case "list#ensureItemInView(..)" must not be called.
Tests:
testcases at LPP-5159, LPP-1322
Modified: openlaszlo/trunk/lps/components/base/baselist.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baselist.lzx 2009-02-23 10:11:04 UTC (rev 13015)
+++ openlaszlo/trunk/lps/components/base/baselist.lzx 2009-02-23 10:24:41 UTC (rev 13016)
@@ -41,7 +41,11 @@
<!--- the selector for this list (lz.listselector or lz.datalistselector)
@keywords private -->
<attribute name="_selector" value="null" />
-
+
+ <!--- true when a list-item set focus to this list (only available during onfocus)
+ @keywords private -->
+ <attribute name="__focusfromchild" value="false" type="boolean" />
+
<!--- This event is triggered whenever the user makes a selection it may
used as a script in the tag or as an event method. -->
<event name="onselect"/>
Modified: openlaszlo/trunk/lps/components/base/baselistitem.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baselistitem.lzx 2009-02-23 10:11:04 UTC (rev 13015)
+++ openlaszlo/trunk/lps/components/base/baselistitem.lzx 2009-02-23 10:24:41 UTC (rev 13016)
@@ -72,9 +72,11 @@
@keywords private -->
<method name="_doMousedown" args="ignore"> <![CDATA[
super._doMousedown(ignore);
- if (!this.focusable && this._parentcomponent &&
- this._parentcomponent.focusable) {
- lz.Focus.setFocus(this._parentcomponent, false); // false => focus from mouse
+ var parcomp = this._parentcomponent;
+ if (!this.focusable && parcomp && parcomp.focusable) {
+ parcomp.__focusfromchild = true;
+ lz.Focus.setFocus(parcomp, false); // false => focus from mouse
+ parcomp.__focusfromchild = false;
}
]]> </method>
Modified: openlaszlo/trunk/lps/components/lz/list.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/list.lzx 2009-02-23 10:11:04 UTC (rev 13015)
+++ openlaszlo/trunk/lps/components/lz/list.lzx 2009-02-23 10:24:41 UTC (rev 13016)
@@ -177,11 +177,13 @@
<method name="_doFocus" args="ignore">
<![CDATA[
super._doFocus(ignore);
- var sel = getSelection();
- if (this.multiselect) {
- sel = (sel.length == 0) ? null : sel[0];
- }
- ensureItemInView(sel);
+ if (! this.__focusfromchild) {
+ var sel = getSelection();
+ if (this.multiselect) {
+ sel = (sel.length == 0) ? null : sel[0];
+ }
+ ensureItemInView(sel);
+ }
]]>
</method>
More information about the Laszlo-checkins
mailing list