On 9/10/15, 3:06 AM, "Harbs" <harbs.li...@gmail.com> wrote:

>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?

Well, IMO, frameworks have rules, like all “components” must implement
IUIComponent, and in this case, all focusable “components” must implement
IFocusManagerComponent (for other reasons, like handling focus correctly
for “grouped focus” like radio buttons, “sub-focus” for popups, or
handling disabled states, really complex nesting of focusable editors in
DataGrid, accessibility/screen-readers, etc.  Essentially all of that code
in FocusManager that wrestles with the default player focus behavior.  And
so if every focusable “component” does implement IFocusManagerComponent
correctly, then I think you don’t need the two lines you are suggesting.
The two lines add tolerance for focus in non-IFocusManagerComponents, but
there might be confusion and trouble elsewhere when you try to allow this
sort of tolerance.  I don’t object to attempts to allow more tolerance,
but I think it can turn out to be a lot of work.

-Alex


Reply via email to