My favorites | English | Sign in

Google AJAX Language API

Class Reference for Virtual Keyboard API

Table of Contents

Class google.elements.keyboard.Keyboard

Constructor

Instances of google.elements.keyboard.Keyboard are designed to control the keyboard settings on a set of textfields in your web page.

Constructor Description

Keyboard(layouts, textfieldIds)

Creates a new Keyboard instance. The layouts argument supplies the keyboard layouts that user can switch to.

  • layouts - Array field that specifies the layouts to preload. Values in the array should be of type google.elements.keyboard.LayoutCode. The first layout in the array will be selected by default. Refer to getSupportedLayouts for more details regarding valid layouts.
  • textfieldIds - Array containing strings of textfield element IDs or textfield element references which the on-screen keyboard should be attached to.
Throws exception under the following cases: layouts is invalid.

Methods

Method Return Type Description

getLayout()

google.elements.keyboard.LayoutCode Gets the active keyboard layout for this Keyboard object.

setLayout(layout)

None

Changes the keyboard layout for this Keyboard object.

  • layout - Value should be of type google.elements.keyboard.LayoutCode

Throws exception under the following case: layout is invalid.

setVisible(visible)

None

Sets the visibility state for this Keyboard object.

  • visible - Boolean indicating if the keyboard is visible.

isVisible()

Boolean Returns a boolean indicating whether onscreen keyboard is visible for this Keyboard object.

Global Methods

Method Return Type Description

google.elements.keyboard.getLayoutName(layout)

String Returns the name of the layout in its native langauge.
  • layout - Value should be of type google.elements.keyboard.LayoutCode

Enums

LayoutCode Enum

The google.elements.keyboard.LayoutCode enumeration provides a mapping from name constants to layout code. Note that layout code doesn't equal to language code. There could be multiple layouts, or input methods, for a single language.

var google.elements.keyboard.LayoutCode = {
  'ALBANIAN': 'sq',
  'ARABIC': 'ar',
  'ARMENIAN_EASTERN': 'hy_east',
  'ARMENIAN_WESTERN': 'hy_west',
  'BASQUE': 'eu',
  'BELARUSIAN': 'be',
  'BOSNIAN': 'bs',
  'BULGARIAN': 'bg',
  'CATALAN': 'ca',
  'CROATIAN': 'hr',
  'CZECH': 'cs',
  'CZECH_QWERTZ': 'cs_qwertz',
  'ENGLISH': 'en',
  'FINNISH': 'fi',
  'GALICIAN': 'gl',
  'GEORGIAN_QWERTY': 'ka_qwerty',
  'GEORGIAN_TYPEWRITER': 'ka_typewriter',
  'GERMAN': 'de',
  'GREEK': 'el',
  'HEBREW': 'he',
  'HINDI': 'hi',
  'HUNGARIAN_101': 'hu_101',
  'KAZAKH': 'kk',
  'KYRGYZ': 'ky_cyrl',
  'MACEDONIAN': 'mk',
  'MONGOLIAN_CYRILLIC': 'mn_cyrl',
  'MONTENEGRIN': 'srp',
  'PERSIAN': 'fa',
  'POLISH': 'pl',
  'ROMANI': 'rom',
  'RUSSIAN': 'ru',
  'SERBIAN_CYRILLIC': 'sr_cyrl',
  'SERBIAN_LATIN': 'sr_latn',
  'SLOVAK': 'sk',
  'SLOVAK_QWERTY': 'sk_qwerty',
  'SLOVENIAN': 'sl',
  'SPANISH': 'es_es',
  'THAI': 'th',
  'TURKISH_F': 'tr_f',
  'TURKISH_Q': 'tr_q',
  'UKRAINIAN_101': 'uk_101',
  'UZBEK_LATIN': 'uz_latn'
};