WoW:API GameTooltip SetText: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
({{widgetmethod}})
m (Move page script moved page API GameTooltip SetText to API GameTooltip SetText without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{widgetmethod}}
{{widgetmethod}}
SetText("text"[, red, green, blue[, alpha[, textWrap]]])


Sets the text of the tooltip.
Sets the text of the tooltip.


----
== Arguments ==


'''Arguments'''
:;"text" : string - The text of the new tooltip. Variable can be used inplace of a string.
:;red : Optional - number range 0 to 1 - red color value for text string 
:;green : Optional - number range 0 to 1 - green color value for text string
:;blue : Optional - number range 0 to 1 - blue color value for text string
:;alpha : Optional - number range 0 to 1 - specifies the opacity of text. Default is 1.
:;textWrap : Optional - {{api|boolean|t=t}} - 'true' to wrap the text string to fit the tooltip box. Default is 'false'.


:("text" [, r, g, b, alphaValue, textWrap])
== Returns ==


:none


:;"text" : String - The text of the new tooltip. Variable can be used inplace of a string.
== Example ==
:;r : Optional - range 0 to 1 - red color value for text string 
:;g : Optional - range 0 to 1 - green color value for text string
:;b : Optional - range 0 to 1 - blue color value for text string
:;alphaValue : Optional - Range - 0 to 1 specifies the transparency of the text. 0=transparent 1=Opaque, default
:;textWrap : Optional - Boolean specifying whether to wrap the text string to fit the tooltip box. 1 = Wrap, 0 = Don't wrap. Default: 0  Note: When using this flag the tooltip width is set at a preset size (about the size 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" arg to force a new line.


If optional parameters are not specified the text defaults to Gold color, Full Opaque, and NON-wraped.
GameTooltip:SetText("This is my awesome tooltip!", 0.5, 0.5, 0.5, 0.75, 1)


----
'''Example'''
    ''GameTooltip:SetText("This is my awesome tooltip!", 0.5, 0.5, 0.5,  0.75, 1)''
Would result in a semi transparent, greyish colored tooltip that would probably be wrapped to a second line due to the textWrap flag and its length.
Would result in a semi transparent, greyish colored tooltip that would probably be wrapped to a second line due to the textWrap flag and its length.
== Details ==
When using the flag the tooltip width is set at a preset size (about the size 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" arg to force a new line.
If optional parameters are not specified the text defaults to Gold color, Full Opaque, and NON-wrapped.

Latest revision as of 04:45, 15 August 2023

Widget API ← GameTooltip < SetText

SetText("text"[, red, green, blue[, alpha[, textWrap]]])

Sets the text of the tooltip.

Arguments[edit]

"text"
string - The text of the new tooltip. Variable can be used inplace of a string.
red
Optional - number range 0 to 1 - red color value for text string
green
Optional - number range 0 to 1 - green color value for text string
blue
Optional - number range 0 to 1 - blue color value for text string
alpha
Optional - number range 0 to 1 - specifies the opacity of text. Default is 1.
textWrap
Optional - boolean - 'true' to wrap the text string to fit the tooltip box. Default is 'false'.

Returns[edit]

none

Example[edit]

GameTooltip:SetText("This is my awesome tooltip!", 0.5, 0.5, 0.5, 0.75, 1)

Would result in a semi transparent, greyish colored tooltip that would probably be wrapped to a second line due to the textWrap flag and its length.

Details[edit]

When using the flag the tooltip width is set at a preset size (about the size 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" arg to force a new line.

If optional parameters are not specified the text defaults to Gold color, Full Opaque, and NON-wrapped.