keyboard_virtual_show


Description

This function can be used to show the virtual keyboard on the device running the game. When you call this function you need to provide one of the following constants for each of the first three arguments:

The last argument is to enable/disable predictive text, and this would be set to true to permit it, and false otherwise, but note that just because it is permitted doesn't mean that it will be used as that will depend on the preferences of the user on the device. When in predictive text mode, the virtual keyboard will not generate normal GameMaker Studio 2 keypress events. Instead, it will only update the last character pressed and keyboard string variables. This is due to the inability to detect whether a change in the internal text field used for detecting key presses came from an actual virtual keyboard key, or a text suggestion. In these cases you would want to read the keyboard_string input as opposed to reading any kind of raw key input.

It is important to note too that the user will get different keyboards with different capabilities depending on the platform OS, with the following caveats for use per target:

Calling this function will generate a System Asynchronous Event, in which the async_load DS map will be populated with the following key/value pairs:


Syntax

keyboard_virtual_show(keyboard_type, return_key_type, autocapitalization_type, predictive_text_enabled);

Argument Description
keyboard_type Determines the keyset available on the virtual keyboard.
return_key_type Determines what is shown on the return/action key of the virtual keyboard.
autocapitalization_type Determines how/if the words typed via the virtual keyboard will be autocapitalized.
predictive_text_enabled Set to true/false to enable/disable predictive text input.


Returns:

N/A


Example:

if input == false
    {
    input = true;
    keyboard_virtual_show(kbv_type_numbers, kbv_returnkey_default, kbv_autocapitalize_none, false);
    }

The above code will bring up the OS virtual keyboard if the given variable is not set to true.