WoW:API GameTooltip AddLine: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API GameTooltip AddLine to API GameTooltip AddLine without leaving a redirect)
 
(9 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<center>'''Title''' ''-Documentation by [[user:Goatus|Goatus]]-''</center>
{{widgetmethod}}
<center>'''Title''' ''-Edited by [[user:ThePooBurner|ThePooBurner]]-''</center>


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
GameTooltip:AddLine(text [, red, green, blue [, wrapText]]);


GameTooltip:AddLine(tooltipText [, textColor.r, textColor.g, textColor.bp, wrapText]]);
Appends a line of text to tooltip.


<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
== Arguments ==


Adds Line with text to tooltip.  
:;text : {{api|string|t=t}} - text which will appear in new tooltip line
:;red : number range 0 to 1 - red color value for text string
:;green : number range 0 to 1 - green color value for text string
:;blue : number range 0 to 1 - blue color value for text string
:;wrapText : {{api|boolean|t=t}} - 'true' to wrap text.


----
== Returns ==
;''Arguments''


<!-- List each argument, together with its type -->
:none


:(tooltipText [, textColor.r, textColor.g, textColor.b , wrapText])
== Examples ==


MyTooltip:SetOwner(TargetFrame, "ANCHOR_RIGHT")
MyTooltip:AddLine("New tooltip line", 1, 1, 1)
MyTooltip:Show()


:;tooltipText : String - string which will appear in new tooltip line
== Details ==
Note that this only appends the new line to the tooltip. It does not update the tooltip's height/width, so that the newly added line initially appears underneath (outside of) the tooltip.


:;textColor.r : range 0 to 1 - red color value for text string
A subsequent call to [[API_Region_Show|GameTooltip:Show()]] will update the tooltip's borders correctly.
:;textColor.g : range 0 to 1 - green color value for text string
:;textColor.b : range 0 to 1 - blue color value for text string
:;wrapText : nil or 1 - Set to 1 to wrap text.


----
== Notes ==
;''Returns''
* As of WoW 2.0, there is no longer a maximum number of lines.
 
* As of 6.0 uses Lua boolean, rather than WoW Boolean (nil or 1) for wrap text setting.
<!-- List each return value, together with its type -->
 
:nothing
 
----
;''Example''
 
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
 
MyTooltip:SetOwner(TargetFrame, "ANCHOR_RIGHT");
MyTooltip:AddLine("New tooltip line", 1,1,1);
MyTooltip:Show():
 
----
4-1-05: Removed the "wrapText" argument as it isn't real. There is no argument after the color with this command. I tested this extensivly when creating custum tooltips for my mod's options pane.
----
{{Template:WoW API}}
<!-- Update the category to the appropriate subsection, and be sure to put the function name as the label for the category link. Multiple subcategories are okay if appropriate, please dont link functions to the API Functions category directly. -->
[[Category:API Functions|Empty Template]]

Latest revision as of 04:45, 15 August 2023

Widget API ← GameTooltip < AddLine

GameTooltip:AddLine(text [, red, green, blue [, wrapText]]);

Appends a line of text to tooltip.

Arguments[edit]

text
string - text which will appear in new tooltip line
red
number range 0 to 1 - red color value for text string
green
number range 0 to 1 - green color value for text string
blue
number range 0 to 1 - blue color value for text string
wrapText
boolean - 'true' to wrap text.

Returns[edit]

none

Examples[edit]

MyTooltip:SetOwner(TargetFrame, "ANCHOR_RIGHT")
MyTooltip:AddLine("New tooltip line", 1, 1, 1)
MyTooltip:Show()

Details[edit]

Note that this only appends the new line to the tooltip. It does not update the tooltip's height/width, so that the newly added line initially appears underneath (outside of) the tooltip.

A subsequent call to GameTooltip:Show() will update the tooltip's borders correctly.

Notes[edit]

  • As of WoW 2.0, there is no longer a maximum number of lines.
  • As of 6.0 uses Lua boolean, rather than WoW Boolean (nil or 1) for wrap text setting.