#prevent text inputs from receiving keys used in actions

7 messages · Page 1 of 1 (latest)

stone plover
#

i have this:ts Input.is_action_just_pressed("zoom_in")
"zoom_in" being CTRL + +, but when I use it while a Text Input is focused, it gets +.

How can I prevent text inputs from receiving keys used in actions?

stone plover
#

i've tried a workaround:

func _unhandled_input(event: InputEvent) -> void:
    if !(event is InputEventKey): return
    if !(event.pressed): return

    if !(Input.is_key_pressed(KEY_CTRL)): return

    code.editable = false```however, this means shortcuts used to interact WITH the text, are no longer working (i.e. CTRL C, CTRL X, CTRL BACKSPACE)
#

and i can't seem to find any other solution gdthinking

#

i can detect when a keystroke is done with this:ts func _unhandled_input(event: InputEvent) -> void: if (event.is_action_pressed("open")): code.editable = falsebut this runs after the character was written in the text input, so it's useless

stone plover
#

it seems that native shortcuts in CodeEdit aren't being recognised as text, so i wonder, is there a way to "append" new shortcuts there?

#

seems they are all done in here

stone plover