0 votes

I'm trying to add RichTextLabels that are clickable with the mouse icon changing to a pointing hand when hovering over the RTL.

With other controls like a regular label or button, I can go to the properties in the editor under Control / Mouse / set Filter to Stop and Default Cursor Shape to Pointing hand and it works fine. Or from code I can set
label.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
and that works fine for regular labels and most other control types that I've tested. But neither approach works with a Rich Text Label. I've confirmed that I can actually click on the RTL and have events happen, so it's not as if it's not detecting mouse events, it just doesn't modify the cursor like most other control nodes so it seems like probably a bug in the engine.

If so, it should be reproducible by making a new empty project and adding one control node like a regular label with placeholder text and setting Control / Mouse / set Filter to Stop and Default Cursor Shape to Pointing hand, then adding a RichTextLabel and doing the same thing, then playing it to see if the mouse cursor changes.

I'm using Windows 10, and the bug happens in both the Godot editor and when I build an HTML5 game and play it online.

Godot version 3.2.3 stable mono official
in Engine by (22 points)

A quick workaround is to add a Control node as a child and make it expand horizontally and vertically to cover the whole text, set the Default Cursor Shape to Pointing Hand and make sure to adjust the Mouse Filter if it doesn't work.

Did you report this bug?

Thanks, that worked! On the off chance that anyone else is encountering the same problem, the steps I took are:

1) Add a MarginContainer as a child to the RichTextLabel
2) Set the MarginContainer Anchors to be 0 for Left and Top, and 1 for Right and Bottom
3) Set the MarginContainer Margins to all be 0
4) Set the MarginContainer Mouse settings to Filter: Pass and Default Cursor Shape: Pointing Hand

It took me longer than I'd like to admit to realize that I couldn't get it to work by changing the Size Flags in the MarginContainer and could only get it to fill the RichTextLabel by changing the Anchors ^_^

Not at first, but now that it looks like it really is a bug and not just me not knowing what I'm doing I reported it in issue #47847, thanks for the reminder

Glad it worked!

Please log in or register to answer this question.

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 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 webmaster@godotengine.org with your username.