flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Guild <jason.gu...@alaska.gov>
Subject Re: composite components and focus delegation
Date Mon, 23 Dec 2013 18:42:09 GMT
Mark:

Thanks for the reply.

In your example, if firstTab were a reference to a composite component 
instance, how would that component delegate the setFocus() call to one 
of the child TextInputs within itself?

The dialog class has only a reference to the entire composite component, 
and the component in the dialog has no knowledge of whether it appears 
in a popup dialog or anywhere else.

Jason

On 12/23/2013 9:22 AM, mark goldin wrote:
> 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/mixed (inline, None, 0 bytes)
View raw message