How to use the system cursor on Control?
Asked Answered
R

4

0

It is necessary that the cursor, when hovering over the Control (in my case, FileDialog), changes from the one specified in the project settings to the system arrow, and vice versa when leaving this element. Changing the script with Input.set_default_cursor_shape() doesn't help. How to fix it?

Ricky answered 21/4, 2023 at 9:53 Comment(0)
T
0

Do you have your code ?

Did you try printing and seeing if your signals mouse_entered and mouse_exited works ?

Tucci answered 21/4, 2023 at 13:59 Comment(0)
R
0

Tucci Mmm... I tried to call Input.set_default_cursor_shape() on mouse_entered signal. Do you understand correctly what I want to do?

Ricky answered 21/4, 2023 at 15:35 Comment(0)
S
0

You connected the mouse_entered signal to a function? Did you verify that the function is getting called at the expected time by placing a print statement in it?

Also:

Note: If you want to change the default cursor shape for Control's nodes, use Control.mouse_default_cursor_shape instead.

https://docs.godotengine.org/en/3.5/classes/class_input.html?#class-input-method-set-default-cursor-shape

In this case, you would set the FileDialog's mouse_default_cursor_shape property to one of the values here, such as Control.CURSOR_ARROW:
https://docs.godotengine.org/en/3.5/classes/class_control.html#enum-control-cursorshape

You can also change the property for the Control in the Inspector:
Mouse >> Default Cursor Shape

Sixfooter answered 21/4, 2023 at 16:7 Comment(0)
R
0

Sixfooter You connected the mouse_entered signal to a function? Did you verify that the function is getting called at the expected time by placing a print statement in it?

Yes, these methods are executed.

Sixfooter Also:
Note: If you want to change the default cursor shape for Control's nodes, use Control.mouse_default_cursor_shape instead.

I don't need this. I have a custom cursor in the game, and I want to make it so that when the mouse enters the element, the cursor becomes the same as in the operating system.

Ricky answered 26/4, 2023 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.