Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIKeyboardIOS Class Reference

Inherits MOAIGlobalClass< TYPE, SUPER >.

List of all members.

Function List

  getText
  showKeyboard
  hideKeyboard

Detailed Description

Wrapper for the native keyboard. This is a first pass of the keyboard functionality and is missing some important features (such as spell check) that will be added in the near future. We also need to trap the keyboard notifications that tell us the position and dimensions of the keyboard.

The decision to divorce the keyboard from the text input field was deliberate. We're not ready (and may never be ready) to own a binding to a full set of native UI widgets. In future releases we'll give better was to connect the software keyboard to a MOAITextBox. This will give better integration of editable text fields with Moai. Even though this is more work up front, it means it will be easier in the long run to keep editable text synchronized with everything else in a scene.

The other short term limitation we face is complex text layout for languages such as Arabic. Since we aren't displaying native text fields, input is limited to what MOAITextBox can display. Support for complex text layout is something we want to handle down the road, but until then we're going to be limited.

If the keyboard (as written) doesn't meet your needs, if should be straightforward to adapt it into a native text field class that does. You'd need to change it from a singleton to a factory/instance type and add some API to position it on the screen, but otherwise most of the callbacks are already handled.

Constants
MOAIKeyboardIOS.EVENT_INPUT
MOAIKeyboardIOS.EVENT_RETURN
MOAIKeyboardIOS.AUTOCAP_ALL
MOAIKeyboardIOS.AUTOCAP_NONE
MOAIKeyboardIOS.AUTOCAP_SENTENCES
MOAIKeyboardIOS.AUTOCAP_WORDS
MOAIKeyboardIOS.KEYBOARD_ASCII
MOAIKeyboardIOS.KEYBOARD_DECIMAL_PAD
MOAIKeyboardIOS.KEYBOARD_DEFAULT
MOAIKeyboardIOS.KEYBOARD_EMAIL
MOAIKeyboardIOS.KEYBOARD_NUM_PAD
MOAIKeyboardIOS.KEYBOARD_NUMERIC
MOAIKeyboardIOS.KEYBOARD_PHONE_PAD
MOAIKeyboardIOS.KEYBOARD_TWITTER
MOAIKeyboardIOS.KEYBOARD_URL
MOAIKeyboardIOS.APPEARANCE_ALERT
MOAIKeyboardIOS.APPEARANCE_DEFAULT
MOAIKeyboardIOS.RETURN_KEY_DEFAULT
MOAIKeyboardIOS.RETURN_KEY_DONE
MOAIKeyboardIOS.RETURN_KEY_GO
MOAIKeyboardIOS.RETURN_KEY_JOIN
MOAIKeyboardIOS.RETURN_KEY_NEXT
MOAIKeyboardIOS.RETURN_KEY_ROUTE
MOAIKeyboardIOS.RETURN_KEY_SEARCH
MOAIKeyboardIOS.RETURN_KEY_SEND

Function Documentation

Returns the text currently being edited (or nil if no editing).


function getText ()
Returns:
text ( string )

Hide the native software keyboard.


function hideKeyboard ()
Returns:
nil

Show the native software keyboard to the use.


function showKeyboard ( [ string text, number type, number returnKey, boolean secure, number autocap, number appearance ] )
Parameters:
text ( string ) Optional. Text to edit (if any). Default value is ''.
type ( number ) Optional. One of MOAIKeyboardIOS.KEYBOARD_ASCII, MOAIKeyboardIOS.KEYBOARD_DECIMAL_PAD, MOAIKeyboardIOS.KEYBOARD_DEFAULT, MOAIKeyboardIOS.KEYBOARD_EMAIL, MOAIKeyboardIOS.KEYBOARD_NUM_PAD, MOAIKeyboardIOS.KEYBOARD_NUMERIC, MOAIKeyboardIOS.KEYBOARD_PHONE_PAD, MOAIKeyboardIOS.KEYBOARD_TWITTER, MOAIKeyboardIOS.KEYBOARD_URL. Default value is MOAIKeyboardIOS.KEYBOARD_DEFAULT.
returnKey ( number ) Optional. One of MOAIKeyboardIOS.RETURN_KEY_DEFAULT, MOAIKeyboardIOS.RETURN_KEY_DONE, MOAIKeyboardIOS.RETURN_KEY_GO, MOAIKeyboardIOS.RETURN_KEY_JOIN, MOAIKeyboardIOS.RETURN_KEY_NEXT, MOAIKeyboardIOS.RETURN_KEY_ROUTE, MOAIKeyboardIOS.RETURN_KEY_SEARCH, MOAIKeyboardIOS.RETURN_KEY_SEND. Default value is MOAIKeyboardIOS.RETURN_KEY_DEFAULT.
secure ( boolean ) Optional. Default value is false.
autocap ( number ) Optional. One of MOAIKeyboardIOS.AUTOCAP_ALL, MOAIKeyboardIOS.AUTOCAP_NONE, MOAIKeyboardIOS.AUTOCAP_SENTENCES, MOAIKeyboardIOS.AUTOCAP_WORDS. Default value is MOAIKeyboardIOS.AUTOCAP_NONE.
appearance ( number ) Optional. One of MOAIKeyboardIOS.AUTOCAP_ALL, MOAIKeyboardIOS.AUTOCAP_NONE, MOAIKeyboardIOS.AUTOCAP_SENTENCES, MOAIKeyboardIOS.AUTOCAP_WORDS. Default value is MOAIKeyboardIOS.AUTOCAP_NONE.
Returns:
nil