12-14-2010 03:56 PM
Has anyone been able to figure out how to code the selection of a text input box, and have the keyboard display? I've been able to select the box itself, but no joy on getting the keyboard to show without having to manually click the text input field.
12-14-2010 04:13 PM
Welcome to the forums! I am not sure i completely understand your question. are you trying to draw out the keyboard through your application without a TextInput object? If that's the case, you should note that the keyboard cannot be brought on to the screen without an input object being focused on. But to manually bring out the keyboard without clicking on an input object such as a TextInput you can swipe from the bottom left corner up to the center of the screen for the keyboard to pop out. Let me know if thats what you were asking or not. Good Luck!
12-14-2010 04:35 PM
Actually what I am looking for is when the application launches, have the program select the textinput field and display the keyboard automatically. A good example would be to have the application launch to a login screen and have the username field already selected, with the keyboard displayed.
12-14-2010 06:04 PM
12-14-2010 06:19 PM - edited 12-14-2010 06:23 PM
@jtegen that made me lol haha... you give me too much credit sir
but i have been working on it. i havent quite managed to get the keyboard up. my theory is there is an event that triggers it to come up. i've tried several with no luck:
.. and several others.
you can dispatch events such a MouseEvent.CLICK without having to actually click with a mouse by using the dispatchEvent() method as follows:
myInputObject.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false)); //or something like this myInputObject.dispatchEvent(new FocusEvent(FocusEvent.FOCUS_IN, true, false));
this will launch events without the user needing to do anything. now in a normal desktop run i am able to launch the app focus in and start typing without moving the mouse. however in the simulator i have no such luck. it focuses and dispatches the events as planned but does not cause the keyboard to come up nor can i start typing with the keyboard (the latter doesnt happen even under normal circumstances sometimes lol).
but if you do a trace you can see the dispatched events are occuring. but so far no luck with the keyboard. my theory is if you can find the right event maybe you can pop up tht keyboard. but more than likely there is more involved to this than we can handle just via the available API's. if anyone can find alternate route tht'd be great. ill keep you posted if i find anything new. good luck!
Edit: you can also do a manual focus on an object using the following line:
stage.focus = myInputObject;