#How to set tooltip through code?

1 messages · Page 1 of 1 (latest)

surreal estuary
#

How do you set a tooltip on a node? is it only on control nodes? I'm trying this out but it's not working:

var control := counter.label.get_node("MarginContainer/Control") as Control
control.hint_tooltip = str(counter.mat.amount)```
#

Invalid assignment of property or key 'hint_tooltip' with value of type 'String' on a base object of type 'Control'.

#

is what I get upon running this code

winter tendon
#

the error is saying hint_tooltip isn't a property of Control nodes
I think tooltip_text is the property you're looking for

surreal estuary
winter tendon
#

idk, you could avoid setting it when it remains the same value

surreal estuary
#

thing is I'm trying to add it as a hover info to show how many of a certain material you have currently

#

so it updates often anyways

winter tendon
#

you can limit how often it updates

#

is the tooltip even showing if it doesn't change?

#

tooltips might just not work for this

surreal estuary
#

mm maybe I should make it just change the text label on hover or something

#

could be easier

winter tendon
#

probably