AllowVirtualKeyboard

AllowVirtualKeyboard

#Overview

name: AllowVirtualKeyboard

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of AllowVirtualKeyboard is to control whether a virtual keyboard can be used on platforms where the main screen is not touch-enabled. This setting is primarily used in the application’s input handling system.

This setting variable is relied upon by the ApplicationCore module, specifically within the GenericPlatformApplicationMisc class. This class is part of the core application functionality in Unreal Engine, handling platform-specific application behaviors.

The value of this variable is set through a console variable (CVar) system. It’s initialized as a static boolean variable bAllowVirtualKeyboard and then wrapped in an FAutoConsoleVariableRef named CVarAllowVirtualKeyboard. This allows the value to be changed at runtime through console commands.

The associated variable bAllowVirtualKeyboard directly interacts with AllowVirtualKeyboard. They share the same value, with bAllowVirtualKeyboard being the actual boolean variable used in the code, while AllowVirtualKeyboard is the name of the console variable.

Developers must be aware that this variable is marked as read-only (ECVF_ReadOnly), which means it’s intended to be set early in the application’s lifecycle and not changed frequently during runtime.

When using this variable, developers should consider the following best practices:

  1. Use it in conjunction with platform-specific checks, as seen in the RequiresVirtualKeyboard() function.
  2. Be cautious about changing its value, as it’s marked read-only and might have implications for input handling across the application.
  3. Consider the performance implications of enabling a virtual keyboard on non-touch platforms.

Regarding the associated variable bAllowVirtualKeyboard:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/GenericPlatformApplicationMisc.cpp:30

Scope: file

Source code excerpt:


FAutoConsoleVariableRef FGenericPlatformApplicationMisc::CVarAllowVirtualKeyboard(
	TEXT("AllowVirtualKeyboard"),
	bAllowVirtualKeyboard,
	TEXT("Allow the use of a virtual keyboard despite platform main screen being non-touch"),
	ECVF_ReadOnly
);

void FGenericPlatformApplicationMisc::PreInit()

#Associated Variable and Callsites

This variable is associated with another variable named bAllowVirtualKeyboard. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/GenericPlatformApplicationMisc.cpp:27

Scope: file

Source code excerpt:

);

static bool bAllowVirtualKeyboard  = false;

FAutoConsoleVariableRef FGenericPlatformApplicationMisc::CVarAllowVirtualKeyboard(
	TEXT("AllowVirtualKeyboard"),
	bAllowVirtualKeyboard,
	TEXT("Allow the use of a virtual keyboard despite platform main screen being non-touch"),
	ECVF_ReadOnly
);

void FGenericPlatformApplicationMisc::PreInit()
{

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/GenericPlatform/GenericPlatformApplicationMisc.cpp:93

Scope (from outer to inner):

file
function     bool FGenericPlatformApplicationMisc::RequiresVirtualKeyboard

Source code excerpt:

bool FGenericPlatformApplicationMisc::RequiresVirtualKeyboard()
{
	return PLATFORM_HAS_TOUCH_MAIN_SCREEN || bAllowVirtualKeyboard;
}

FLinearColor FGenericPlatformApplicationMisc::GetScreenPixelColor(const FVector2D& InScreenPos, float InGamma)
{ 
	return FLinearColor::Black;
}