How can I capture text input from any keys?

Hey guys,

I’m currently trying to move our UI from Slate to Coherent for design purposes. I’m having a bit of trouble re-creating our search box function though. I can pass mouse events to Coherent since there are MouseDown and MouseUp events in the input config file that can be bound to events in my Character.cpp file.

What I can’t figure out is a way to find fire an event whenever any key on the keyboard is pressed or alternatively to run a check every tick to see what keys are pressed without having a stupidly long input config file with every single key in it, or a huge if else if chain to check every single key manually every single tick.

I’m hoping there’s a function or something that I’m missing, anyone know what it is?

You can get by overriding this function on your on UGameViewportClient

https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/Engine/UGameViewportClient/InputKey/index.html

Then you select you class in Project Settings->General Settings->Default Classes

Hmmm, that looks like what I want, but I’m not sure how I should use it. Can I override it in my Character or HUD .cpp file? I don’t really want to extend FViewportClient just to get keypresses that should really be accessible from most places…

Hmmm i corrected my anwser :stuck_out_tongue:

That’d work, but I’m not really interested in creating a custom class and messing with default classes. Does anyone else know a way to get any text input from a Character or HUD class?

That “messing with” is no different that you doing with Character or HUD, considering Epic let you change that class in config, it means it’s ok to override it. Besides you can’t get more raw key data from Unreal APIs then from Viewport which handles input.

Thanks for the answer, . But can you tell me how I can access this Function in my Custom HUD? Sry, I am new to C++…