Looks good to me! On Dec 6, 2010, at 12:25, [email protected] wrote:
> Author: hqm > Date: 2010-12-06 09:25:37 -0800 (Mon, 06 Dec 2010) > New Revision: 17963 > > Modified: > openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as > Log: > Change hqm-20101206-mcl by [email protected] on 2010-12-06 11:40:00 EST > in /Users/hqm/openlaszlo/trunk2 > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: cache selection range in swf10 when input text loses focus > > New Features: > > Bugs Fixed: LPP-9562 > > Technical Reviewer: ptw > QA Reviewer: ffeng > Doc Reviewer: (pending) > > Documentation: > > Release Notes: > > Overview: > > > Details: > > When the input field loses focus, cache the selection range. > > Make getSelectionPosition and getSelectionSize use the cached value if the > inputtext does > not have focus. > > > Tests: > > test case from bug report, selection info is available after text field loses > focus > > > > Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as > =================================================================== > --- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as > 2010-12-06 16:42:20 UTC (rev 17962) > +++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as > 2010-12-06 17:25:37 UTC (rev 17963) > @@ -80,6 +80,33 @@ > } > > > +var __cachedSelectionPos:int = 0; > +var __cachedSelectionSize:int = 0; > + > +function __cacheSelection ():void { > + this.__cachedSelectionPos = textfield.selectionBeginIndex; > + this.__cachedSelectionSize = textfield.selectionEndIndex - > textfield.selectionBeginIndex; > +} > + > +override function getSelectionPosition() :int { > + if (LFCApplication.stage.focus == this.textfield) { > + return textfield.selectionBeginIndex; > + } else { > + return __cachedSelectionPos; > + } > + > +} > + > +override function getSelectionSize() :int { > + if (LFCApplication.stage.focus == this.textfield) { > + return textfield.selectionEndIndex - > textfield.selectionBeginIndex; > + } else { > + return __cachedSelectionSize; > + } > +} > + > + > + > /** > * Called from LzInputText#_gotFocusEvent() after focus was set by > lz.Focus > * @access private > @@ -152,6 +179,7 @@ > * @access private > */ > function __lostFocus (event:FocusEvent) :void { > + __cacheSelection(); > if (owner) owner.inputtextevent('onblur'); > } > > > > _______________________________________________ > Laszlo-checkins mailing list > [email protected] > http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
