Andre did some detective work and noticed that in swf8, we defer the "blur"
call using an onidle callback , and there is a
cryptic comment about that which implies we're leaving enough time for
whoever else was clicked on to grab the selection before we clear it.
/**
* @access private
*/
TextField.prototype.__lostFocus = function () {
if (this['__handlelostFocusdel'] == null) {
this.__handlelostFocusdel = new LzDelegate(this,
"__handlelostFocus");
}
lz.Idle.callOnIdle(this.__handlelostFocusdel);
}
/**
* must be called after an idle event to prevent the selection from being
* cleared prematurely, e.g. before a button click. If the selection is
* cleared, the button doesn't send mouse events.
* @access private
*/
TextField.prototype.__handlelostFocus = function (ignore) {
if (this.__lzview) this.__lzview.inputtextevent('onblur');
}
So for Fred's purposes, in swf10 it might be sufficient to also place the
call to deselect() in an onidle callback,
and maybe his application would have time to copy the selection before it
was cleared?
On Sun, Dec 5, 2010 at 8:20 AM, André Bargull <[email protected]> wrote:
> The various deselect() methods do different things:
> swf8:
> - clears the native flash focus
> swf9+:
> - sets the selection size to zero
> dhtml:
> - hides the click-divs, restores cancelKeys, etc.
>
> Therefore simply removing the call to deselect() sounds a bit wrong.
>
> ---
>
> In general, focus handling for the swf runtimes is implemented as follows:
> (1) Explicit focus changes by Lz.Focus:
> a) "onfocus" ::
> lz.InputText#_gotFocusEvent() -> LzInputTextSprite#gotFocus() ->
> LzInputTextSprite#select() [followed by instructions in 2a]
> b) "onblur" ::
> lz.InputText#_gotBlurEvent() -> LzInputTextSprite#gotBlur() ->
> LzInputTextSprite#deselect() [followed by instructions in 2b]
>
> (2) Native focus changes:
> a) "onSetFocus" / "FOCUS_IN" ::
> LzInputTextSprite#__gotFocus() -> lz.InputText#inputtextevent('onfocus') ->
> Lz.Focus.setFocus() [followed by instructions in 1a]
> b) "onKillFocus" / "FOCUS_OUT" ::
> LzInputTextSprite#__lostFocus() -> lz.InputText#inputtextevent('onblur') ->
> Lz.Focus.clearFocus() [followed by instructions in 1b]
>
> swf8 defers the call to inputtextevent('onblur'), see __handlelostFocus().
> Maybe the intent was to make it possible to query the selection before the
> native focus is removed, here's the comment from that function:
>
>> /**
>> * must be called after an idle event to prevent the selection from being
>> * cleared prematurely, e.g. before a button click. If the selection is
>> * cleared, the button doesn't send mouse events.
>> * @access private
>> */
>>
> The first sentence indicates this is about querying the selection. But I'm
> not sure about the second sentence, maybe someone else can explain what it
> means...
>
>
>
>
>
> On 12/5/2010 6:43 AM, Henry Minsky wrote:
>
>>
>> Change hqm-20101205-R9I by [email protected] on 2010-12-05 00:39:47 EST
>> in /Users/hqm/openlaszlo/trunk2
>> for http://svn.openlaszlo.org/openlaszlo/trunk
>>
>> Summary: LzInputTextSprite.gotBlur should not clear selection
>>
>> New Features:
>>
>> Bugs Fixed: LPP-9562
>>
>> Technical Reviewer: max
>> QA Reviewer: ffeng
>> Doc Reviewer: (pending)
>>
>> Documentation:
>>
>> Release Notes:
>>
>> Overview:
>>
>>
>> Details:
>>
>> This change makes it so that LzInputTextSprite.gotBlur no longer clears
>> the selection
>>
>>
>> Tests:
>>
>> test case from bug report
>>
>> Files:
>>
>> M WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
>> M WEB-INF/lps/lfc/kernel/dhtml/LzInputTextSprite.js
>> M WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as
>>
>> Changeset:
>> http://svn.openlaszlo.org/openlaszlo/patches/hqm-20101205-R9I.tar
>>
>>
>>
--
Henry Minsky
Software Architect
[email protected]