Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

UIOBJECT GameTooltip

Last wiki revision 2023-08-03

GameTooltip (inherits from ) formats a tooltip. There is one named, but others are created with or.

Custom tooltips made in Lua must inherit a virtual XML template:

  • SharedTooltipTemplate - Includes base font strings and textures.
  • GameTooltipTemplate - Additionally includes a unit health bar.

Alternatively, see for minimum requirements in XML.

  • clears and hides the tooltip, then sets a temporary "owner" independent of the frame's "parent".
  • The second argument anchors the tooltip rather than.
  • Use ANCHOR_NONE for scanning tooltips (more details below).
  • resizes the tooltip and reapplies any anchor defined with SetOwner.
  • Showing a tooltip without content causes it to hide and clear its owner.
  • AppendText and most Set methods (SetUnit, SetItemByID, etc.) trigger Show; however, AddLine and AddDoubleLine do not.
  • clears the tooltip's owner.
  • is an alternative without clearing the owner (and anchor).
  • and similar methods add new lines as required, called and.
  • Each new copies the same object as the previous line.
  • However, the tooltip malfunctions without the first line present before loading (i.e. defined in XML).

AddOns commonly create a hidden tooltip with to query methods invisibly to the player. Scanning tooltips can impact performance, so it is best to cache results and consider other API whenever feasible.

Each time scanning is desired, call ClearLines, populate the tooltip, and then read the contents of the text fields.

Function to return a table containing all the lines in the tooltip

Iterator for looping through all tooltip lines

Macro to print each line: /run for i=1,GameTooltip:NumLinesdo print(_G["GameTooltipTextLeft"..i]:GetText)end

Macro to print left and right lines: /run for i=1,select("#",GameTooltip:GetRegions)do local region=select(i,GameTooltip:GetRegions)if region and region:GetObjectType=="FontString" and region:GetTextthen print(region:GetText) end end

Creating a scanning tooltip in Lua that has all features (status bar, textures, etc.):

Source

https://warcraft.wiki.gg/wiki/UIOBJECT_GameTooltip · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.