But if a component implements IIMESupport, why should the FocusManager turn off 
IME if it does not implement IFocusManagerComponent?

It seems to me that the code should be something like this (which also has the 
advantage of being clearer and more concise):

_lastFocus = findFocusManagerComponent(InteractiveObject(target));
if (Capabilities.hasIME && IMEEnabled)
{
    if (_lastFocus is IIMESupport)
        IME.enabled = (_lastFocus as IIMESupport).enableIME;

    else if (target is IIMESupport)
        IME.enabled = (target as IIMESupport).enableIME;

    else
        IME.enabled = false;

}

Am I missing something?

On Sep 10, 2015, at 1:07 AM, Alex Harui <aha...@adobe.com> wrote:

> Yep, that’s the point of IFocusManagerComponent.  The thing we think of as
> the component rarely has focus.  Even a TextInput wraps the TextField or
> RichTextEditor.
> 
> -Alex
> 
> On 9/9/15, 2:42 PM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
>> Of course, the component does not handle focus itself. That’s handled by
>> the SelectionManager…
>> 
>> On Sep 10, 2015, at 12:41 AM, Harbs <harbs.li...@gmail.com> wrote:
>> 
>>> Apparently, the way to go would have been to implement
>>> IFocusManagerComponent as well…
>>> 
>>> On Sep 10, 2015, at 12:37 AM, Harbs <harbs.li...@gmail.com> wrote:
>>> 
>>>> Here’s the full class that’s the target:
>>>> 
>>>>    public class TLFContainer extends SpriteVisualElement implements
>>>> IIMESupport
>>>>    {
>>>>            private var _imeMode:String;
>>>>            
>>>>            public function TLFContainer()
>>>>            {
>>>>                    super();
>>>>            }
>>>>            
>>>>            public function get enableIME():Boolean{
>>>>                    return true;
>>>>            }
>>>>            
>>>>            public function get imeMode():String{
>>>>                    return _imeMode;
>>>>            }
>>>>            
>>>>            public function set imeMode(value:String):void{
>>>>                    _imeMode = value;
>>>>                    
>>>>            }
>>>> 
>>>> It’s used as the text container of the ContainerController.
>>>> 
>>>> On Sep 10, 2015, at 12:34 AM, Alex Harui <aha...@adobe.com> wrote:
>>>> 
>>>>> What is target?  findFocusManagerComponent does a walk up the tree
>>>>> looking
>>>>> for certain flags.
>>>>> 
>>>>> -Alex
>>>>> 
>>>>> On 9/9/15, 2:31 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>>>>> 
>>>>>> I found the culprit: FocusManager.
>>>>>> 
>>>>>> It has the following code:
>>>>>>          _lastFocus =
>>>>>> findFocusManagerComponent(InteractiveObject(target));
>>>>>> 
>>>>>>  if (Capabilities.hasIME)
>>>>>>          {
>>>>>>              var usesIME:Boolean;
>>>>>>              if (_lastFocus is IIMESupport)
>>>>>>              {
>>>>>>                  var imeFocus:IIMESupport = IIMESupport(_lastFocus);
>>>>>>                  if (imeFocus.enableIME)
>>>>>>                      usesIME = true;
>>>>>>              }
>>>>>>              if (IMEEnabled)
>>>>>>                  IME.enabled = usesIME;
>>>>>>          }
>>>>>> 
>>>>>> In my case _lastFocus was null. target does implement IIMESupport
>>>>>> but it
>>>>>> apparently could not be found by findFocusManagerComponent().
>>>>>> 
>>>>>> On Sep 3, 2015, at 3:19 PM, Harbs <harbs.li...@gmail.com> wrote:
>>>>>> 
>>>>>>> FWIW, I did not figure out what was disabling the IME.
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 

Reply via email to