enyo.keyboard

enyo.keyboard is a collection of methods for dealing with the virtual keyboard on webOS. The virtual keyboard has two modes, the automatic mode (the default), in which the keyboard automatically appears when the user puts focus on a text input control, and a manual mode, in which the keyboard is shown and hidden under program control.

Since the keyboard appears on screen with your application, the question arises as to how the keyboard and app will share screen space. In the default mode, your app window resizes to accommodate the keyboard. There is also an alternate mode, in which the keyboard is displayed as a popup over your window. The latter mode may be preferable if resizing your UI is an expensive operation; however, in that case, you'll need to ensure that the user input area isn't positioned under the keyboard.

Methods

enyo.keyboard.setResizesWindow(inResizesWindow)

If inResizesWindow is true (the default value), sets the keyboard mode to resize the application window to fit the keyboard; if false, sets the keyboard mode to display the keyboard on top of application content.

enyo.keyboard.setManualMode(inManual)

If inManual is true, sets the keyboard to be in manual mode. In manual mode, the keyboard will not automatically display when an element that can receive key input is focused or blurred. Also, while in manual mode, it's possible to show or hide the keyboard by calling enyo.keyboard.show or enyo.keyboard.hide, respectively.

enyo.keyboard.show(inType)

Shows the keyboard. Requires the keyboard to be in manual mode, so call enyo.keyboard.setManualMode(true) first.

inType is an integer indicating the keyboard style to show. Possible values are:

0: Text (enyo.keyboard.typeText)
1: Password (enyo.keyboard.typePassword)
2: Search (enyo.keyboard.typeSearch)
3: Range (enyo.keyboard.typeRange)
4: Email (enyo.keyboard.typeEmail)
5: Number (enyo.keyboard.typeNumber)
6: Phone (enyo.keyboard.typePhone)
7: URL (enyo.keyboard.typeURL)
8: Color (enyo.keyboard.typeColor)

enyo.keyboard.hide()

Hides the keyboard. Requires the keyboard to be in manual mode, so call enyo.keyboard.setManualMode(true) first.

enyo.keyboard.forceShow(inType)

Forces the keyboard to show by setting manual keyboard mode and then showing the keyboard. See enyo.keyboard.show for inType values.

enyo.keyboard.forceHide()

Forces the keyboard to hide by setting manual keyboard mode and then hiding the keyboard.

enyo.keyboard.isShowing()

Returns true if the keyboard is showing, or false if it isn't.

enyo.keyboard.isManualMode()

Returns true if the keyboard is in manual mode, or false if it isn't.