GameTooltip:AddDoubleLine
Jump to navigation
Jump to search
Add a line to a GameTooltip consisting of a left-aligned part and a right-aligned part.
GameTooltip:AddDoubleLine(leftText [, rightText, leftR, leftG, leftB , rightR, rightG, rightB])
Arguments
- leftText
- string - Text to be displayed on the left.
- rightText
- string? - Text to be displayed on the right.
- leftR
- number? - Red color component for the left text, between 0 and 1.
- leftG
- number? - Green color component for the left text, between 0 and 1.
- leftB
- number? - Blue color component for the left text, between 0 and 1.
- rightR
- number? - Red color component for the right text, between 0 and 1.
- rightG
- number? - Green color component for the right text, between 0 and 1.
- rightB
- number? - Blue color component for the right text, between 0 and 1.
Example
The following snippet would display a tooltip to the right of the cursor, with the word "Left" in red on the left side and the word "Right" in blue on the right side:
GameTooltip:ClearLines()
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR_RIGHT")
GameTooltip:AddDoubleLine("Left", "Right", 1, 0, 0, 0, 0, 1)
GameTooltip:Show()
Details
- The default color for the text is NORMAL_FONT_COLOR (1.0, 0.82, 0.0).
- To use the default color for the left text and a custom color for the right text, use nil as the value for the left text's color components.
Optional parameters
- Calling this without any parameters has no effect but it will not error.
- Calling this with only
leftText
is equivalent to GameTooltip:AddLine() - Calling this with only
rightText
will result in lack of vertical spacing, regardless of callingGameTooltip:Show
.
GameTooltip:AddDoubleLine(nil, "hello")
GameTooltip:AddDoubleLine(nil, "world", nil, nil, nil, 1, 0, 0)
GameTooltip:Show()