GameTooltip:SetText

From Warcraft Wiki
Jump to navigation Jump to search

Sets the text of a tooltip.

GameTooltip:SetText(text [, r, g, b, alpha, textWrap])

Arguments

text
String - The text for the tooltip.
r
number?Optional. Could be nil. - Optional red color value for text, between 0 and 1.
g
number?Optional. Could be nil. - Optional green color value for text, between 0 and 1.
b
number?Optional. Could be nil. - Optional blue color value for text, between 0 and 1.
alpha
number?Optional. Could be nil. - Optional alpha value for the text, between 0 (transparent) and 1 (fully opaque).
textWrap
boolean?Optional. Could be nil. - True if text should wrap; false if the tooltip must widen to fit it.

Details

  • The default color for the text is NORMAL_FONT_COLOR (1.0, 0.82, 0.0).
  • The default alpha value is 1.
  • When using the textWrap flag, the tooltip width is set to a preset value, which is about the width of the ability tooltips on spells. Long tooltips will go off the side of the screen if this is not set. Alternatively you can simply use a "\n" in the text argument to force a new line.

Example

Displays a semi-transparent, greyish-font tooltip that wraps to accomodate the length of text:

GameTooltip:SetText("This is a sample tooltip with lots of text that is permitted to wrap.", 0.5, 0.5, 0.5,  0.75, true);
GameTooltip:Show();

See also