TextBox InputEvent

Jack106

30-11-2009 20:35:13

Hey,
it is maybe a stupid question, but is there a possibiltiy that i recive only an event from aTextBox wenn it lostFocus or when somebody press enter when the curser is in the textbox?
I know there is the TextInputValidator, but is there no easier way? I don't want to recive events for any button that is pressed.
Hope my question is understandable.

Thanks

kungfoomasta

30-11-2009 21:20:27

You can register to listen for the WIDGET_EVENT_KEYBOARD_INPUT_LOSE Widget Event, which would be called when the TextBox loses input focus. As for detection of pressing the Enter key, you could listen for WIDGET_EVENT_KEY_DOWN event, and check if the key pressed is the Enter key. As far as input is concerned, the Enter key is no different than any other key. I know the Enter key is very common for widgets like the TextBox, however if I were to provide an easy way to listen just for the Enter key, I'd be doing the exact same thing, listening for key press, checking if its enter key, then firing an event.

Jack106

01-12-2009 07:40:46

Yeah thank you i know this methods already, but i thought there is maybe one more only for the enter KEY :), so i will do it like you say and use WIDGET_EVENT_KEY_DOWN.

Thanks again.