I'm wondering if it's possible to prevent a Control from losing focus when a direction ("up", "down", "left", or "right") is pressed.
Problem: I've made a console GUI with an InputField and I'd like the
KEY_DOWN event scancodes to replace its text with the next element from the command history, while retaining the input focus. The problem is that pressing a direction transfers the input focus to a neighbor Control node in the scene.
Failed Attempt: I tried forcing focus back on the InputField when a direction was pressed, but the transfer seems to happen after the InputField processes the event. For example, the following code does not maintain the input focus:
if ( <KEY_UP is pressed, etc.> ):
var inp = get_node("InputField")
# The neighbor above the "InputField" is still selected afterward
Is it possible to make Controls opt out of being selected due to direction input?
I realize it's possible to bounce back focus to the InputField by adding a script to its neighbors, but I'd rather not have to do this for each of a given Control's neighbors every time I'd like to implement a "sticky" input focus behavior.