Skip to main content

Tooltip

Example

var btn = new Button(0, 0, 100, 30);
btn.state.text = "Hover here";

var tooltip = new UiTooltip();
with (tooltip.state) {
linked_component = btn;
}
tooltip.set_text("My Tooltip");
tooltip.move();

State reference

VariableDescriptionTypeDefault
linked_componentTooltip will be shown when hovering on the linked componentString
textTooltip displayed textString
typeTooltip typeRealui_enum_variants.secondary
text_sepDistance in px between each lineReal-1 (default spacing)
text_max_widthRow max width before going on a newlineReal-1 (no newlines by default)
padding_horizontalHorizontal tooltip padding (in px)Real10
padding_verticalVertical tooltip padding (in px)Real5
offset_horizontalHorizontal tooltip offset (in px)Real0
offset_verticalVertical tooltip offset (in px)Real10
show_delayDelay to show the tooltip (in milliseconds)Real500
stay_within_guiAvoid to place the tooltip out of the GUIBooltrue

Methods

set_text(text, sep, max_width)

Set the text of the tooltip, auto-resizing the container, according to the padding

ParamDescriptionTypeDefault
textTooltip textString
sepDistance between each line (in px)Real-1
max_widthMax row widthReal-1

move()

Automatically set the tooltip coordinates based on the linked component position. Before calling this function, ensures that the text has been set, so that the component height has already been determinated.