flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Re: composite components and focus delegation
Date Mon, 23 Dec 2013 18:22:45 GMT
In my base popup class I have the following code (simplified):
public firstTab:*;

this.addEventListener(FlexEvent.CREATION_COMPLETE, registerFirstTab);

private function registerFirstTab(event:FlexEvent):void
{
     firstTab.setFocus();
     this.removeEventListener(FlexEvent.CREATION_COMPLETE,
registerFirstTab);
}
Implementation is responsible to populate firstTab with an object it wants
to have a focus on.




On Mon, Dec 23, 2013 at 12:12 PM, Jason Guild <jason.guild@alaska.gov>wrote:

> Hi all:
>
> I have a reusable component that consists of many TextInputs that make up
> a mailing address form. When I use this component inside of a popup dialog
> I want to give focus to the first focusable component within the address
> form.
>
> What is the best way to do this in the dialog so that I don't have to
> hardcode setFocus() on any of the particular fields within the address
> form? Does the address form component implement IFocusManagerComponent? If
> so, what is the recommended way of delegating focus within the address form
> component? Do I override UIComponent.focusInHandler() in the composite
> component and call setFocus() on one of the child TextInputs?
>
> Ideally, in my dialog I would simply call addrForm.setFocus() when it is
> shown and the address form would decide which of the sub-components should
> receive the focus. Any help on gotchas or other details I need to account
> for are greatly appreciated.
>
> Thanks,
> Jason
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message