Events, keyboard & mouseSDL 3.2

SDL_StopTextInput

Turns text input off again: no more SDL_EVENT_TEXT_INPUT, and the on-screen keyboard closes.

Signature

bool SDL_StopTextInput(SDL_Window *window);

How it works

Call it when the text field loses focus. Leaving text input on during gameplay can make some input methods pop up candidate windows when the player presses letter keys.

Parameters

windowSDL_Window *

The window.

Return value

true on success, false on failure.

Example

example.cpp
1if (e.type == SDL_EVENT_KEY_DOWN && e.key.key == SDLK_RETURN) {
2    submit(playerName);
3    SDL_StopTextInput(window);
4}
Official SDL wiki