This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hello to all reading this post.

I´m currently fiddeling around with the LineEdit node.
Basically, I want to have custom functions for the KEYUP and KEYDOWN event on the line edit, unfortunatly, it uses those keys internally to navigate in the line (Up moves the cursor to the beginning of the line, down moves it to the end).
Is there any way to disable this behaviour ? I guess I´m just too blind or to dumb to find it...

Best regards,
Major

in Engine by (18 points)

1 Answer

+1 vote
Best answer

Hi,

You can use set_input_as_handled inside _input() so it does not propagate and does not the funciton intended on the line edit.. for example:

func _input(event):
    if event.is_action_pressed("ui_up") and $LineEdit.has_focus():
        print("up")
        get_tree().set_input_as_handled()

That script is set on a main scene that hase LineEdit as child. If you press up arrow when focusing the LineEdit, it will print "up" and exit, and wont do the effect expected on the LineEdit.

by (3,505 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.