![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | tayete |
Hi all:
I am trying to get the scancode of the characters that are entered in a LineEdit. I am using find_scancode_from_string to print the code of the letters or puncutation symbols (“,” “.”) entered.
For simplicity, I have created a scene with just a LineEdit and a Label which changes its text with the text entered via a signal from the LineEdit, while the console shows its scancode.
In the following code you may check how if you write an “a” in the LineEdit, it works perfectly showing a “a” and prints its code “65” , but if you write a “,” it shows that “,” but code “0”. Same with “(”, “.” and on… Any ideas?
extends Node2D
func _ready():
pass # Replace with function body.
func _on_LineEdit_text_entered(new_text):
$"Label".set_text(new_text)
print(new_text)
var scan = OS.find_scancode_from_string(new_text)
print(scan)