Native keyboard sample code?

The example in the documentation doesn't really demonstrate the usage very well. There's no sample code for the native text field/keyboard etc. Some clear examples would be nice.

Also, why is there no "done" button when the keyboard pops up?

Hi, meadmesiter. The "Social/Twitter" sample code shows how to implement the keyboard in a real-world situation, including event responses. But let us know if you have any further questions beyond that example.

Whether a "Done" button is appropriate depends on context and interface design. You can implement it by creating a button in Corona and calling a function that sets the keyboard focus to "nil":

native.setKeyboardFocus( nil )

...which will make the keyboard go away. Alternatively, you could detect touches from the screen not covered by the keyboard, and then dismiss it based on that event; this is also a widespread design practice in iPhone apps. It comes down to what you think is the right interface for your specific app.

I am also having trouble to find docs/samples on keyboard use.
I writing a game for "racing a car". The user will user the keyboard to move the car, left, right,up, down. How to handle and capture those events?. Will it work on the simulator?

views:1488 update:2011/9/18 10:09:28
corona forums © 2003-2011