Click or drag to resize

Control_MakeCustomTooltip Method

Virtual method to be implemented by the user. Returns a Control node that should be used as a tooltip instead of the default one. The for_text includes the contents of the HintTooltip property.

The returned node must be of type Control or Control-derived. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if you want to use a pre-existing node from your scene tree, you can duplicate it and pass the duplicated instance).When null or a non-Control node is returned, the default tooltip will be used instead.

The returned node will be added as child to a PopupPanel, so you should only provide the contents of that panel. That PopupPanel can be themed using SetStylebox(String, String, StyleBox) for the type "TooltipPanel" (see HintTooltip for an example).

Note: The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its RectMinSize to some non-zero value.

Example of usage with a custom-constructed node:

func _make_custom_tooltip(for_text):
    var label = Label.new()
    label.text = for_text
    return label

Example of usage with a custom scene instance:

func _make_custom_tooltip(for_text):
    var tooltip = preload("res://SomeTooltipScene.tscn").instance()
    tooltip.get_node("Label").text = for_text
    return tooltip

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public virtual Control _MakeCustomTooltip(
	string forText
)

Parameters

forText
Type: SystemString

[Missing <param name="forText"/> documentation for "M:Godot.Control._MakeCustomTooltip(System.String)"]

Return Value

Type: Control

[Missing <returns> documentation for "M:Godot.Control._MakeCustomTooltip(System.String)"]

See Also