Is there any way to get the selected text? My idea was to check the bbcode font color of the single characters if it matches the font_color_selected property. But how may I find out that property of a single string/character? Is there any counterpart of bbcodes push_color() function?
Get selected text from RichTextLabel/TextEdit
RichTextLabel has get_selection_text()
- Edited
Hmm, you're partially right. InputText has the function get_selection_text(). That solves my problem partially. I do not find that function for RichTextLabel (Godot 3.1.1 stable)
As a workaround, I have replaced the RichTextLabel with an InputText in readonly node. Now I've got the problem, that I cannot customize the font_color. Readonly seems to have a "transparent mode" but I cannot find where to change that. I hope that the picture makes my problem something clearer.
Thanks for your answer and the hint. But the problem is, that I need to find out which string the player has selected. For InputText it is perfectly possible with get_selection_text() But I am missing the same function for RichTextLabel. I do wonder then as well why RichTextLabel would need that property "selection_enabled". It is worthless, if there is no possibility to find out which part was selected.