Tony Alves
Flex, .Net, and Fluorine

Extending TextInput Revisited

Saturday, 18 August 2007 16:43 by talves
In an Earlier Post, I extended the TextInput to capture the enter key.

After being set straight by Alex H. and Graham on flexcoders, I see it may have been overkill. Instead of extending the control to capture the enter key, all that was needed was to use enter="somefunction()".

private function handleMoveNext(event:Event):void
{
var fm:IFocusManager = event.target.focusManager;
var next:IFocusManagerComponent =
fm.getNextFocusManagerComponent();
fm.setFocus(next);
}
<mx:TextInput id="firstBox"
tabIndex="0"
enter="handleMoveNext(event)"/>
<mx:TextInput id="secondBox"
tabIndex="1"
enter="handleMoveNext(event)"/>
I think the example is still valid to show how you can extend the control to capture input into the TextInput, but my usage did not require any extending of the control.

See for yourself:

ExtendingControls Demo
Put focus in one of the boxes; Hit the enter key; You will see the focus change; Try not to use the mouse (hard for me at first).

Not Extended Demo
Put focus in one of the boxes; Hit the enter key.


ExtendingControls Source

You can also right click and View Source.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:  
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

October 6. 2008 08:04