Godot Version
4.3
Question
I am a beginner. I created a small scene and it worked fine.
I have:
PanelContainer:
- RichTextLabel
- TextEdit (hidden)
and the code:
extends PanelContainer
# Logic:
# 1. By default, RichTExtLabel is visible
# 2. If we click on it, TextEdit appears and RichTextLabel hidden.
# 3. If we press ESC we return to RichTextLabel
@onready var text_edit = get_node("TextEdit")
@onready var rich_text_label = get_node("RichTextLabel")
func _on_rich_text_label_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.pressed:
rich_text_label.hide()
text_edit.show()
func _input(event):
if event is InputEventKey:
if event.pressed and event.keycode == KEY_ESCAPE:
if text_edit.visible:
rich_text_label.text = text_edit.text
text_edit.hide()
rich_text_label.show()
I saved this as a scene.
Then I added it to a new scene, but it is not working. Why the click is not being detected by RIchTextLabel