I’m trying to do it when I press the “Num Lock” key, he calls the “TAB” key as if I pressed “TAB” on the keyboard, because I’m creating a browser for the TVOS platform where the remote control has buttons with command keys arrows, num lock and enter, but the web browser widget requires the TAB key to focus within the buttons on the page and the TVOS control does not have this key. So I chose the Num Lock key which is the “Play / Pause” button on the remote control so that when pressed, it calls the TAB key so that I can interact with the web page and focus on the buttons and links on the site.
My attempts
? .
I think something like this should do it:
FViewportClient* client = GEngine->GameViewport->Viewport->GetClient();
client->InputKey(GEngine->GameViewport->Viewport, 0, EKeys::B, EInputEvent::IE_Pressed);
It didn’t work, I added the begin play event to the C ++ character
.
I am inexperienced in C ++, could you give me more instructions? Okay, I created a public player class in C ++ and I must add this argument to the command line, but I want the command to be executed immediately when the game opens.
Simulating a button press is rarely the best way to do things so I think perhaps you’d be better off looking at a different way of calling into the system to get the focus on the browser (I’m not really familiar with the TVOS problem so I can’t be more direct, but if you can find out what actually happens when you press Tab, you might be able to call those methods yourself). However, with the code I posted before it might just be that you need to change the EKeys::B to EKeys::Tab if you havent already tried it (Might not be exactly that, but your auto complete should help)
Another possibility is to edit the webbrowser plugin to replace the “tab” key of the argument that makes it focus on the webbrowser buttons with “Nun lock”
But I don’t know how to do this, help me?
It’s really hard to help without actually seeing what you’re trying to do / how the plugins you’re using work etc. All I can really say is that somewhere, something is listening for the Tab key to be pressed and when it is, some method is called. This might be in the plugin your using, or maybe it’s within the engine / TVOS SDK (like I said, I’ve never used UE4 to do TVOS stuff so I’m not familiar with it). You need to find this location and either change it so it’s listening for NumLock, or find what happens when Tab is called and call that yourself when NumLock is pressed.
In case I’m just using the webbrowser widget plugin only and when I press the tab key it focuses on the link buttons on the current web page and I want to change the tab to nun lock, I didn’t find the argument on the command line of this plugin to change this . The webbrowser plugin is already installed in UE4 and can be activated, soon it will appear in the options in the BP of a widget.