Quantcast
Textures in GameTooltip - WoWInterface
 
Thread Tools Display Modes
07-04-19, 03:45 AM   #1
FranekW
A Cyclonian
 
FranekW's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 41
Textures in GameTooltip

Hi,

I am trying to add a texture to GameTooltip. At the moment, it is placed in its default position, which is LeftTop corner. I found out GameTooltip:AddTexture also accepts an optional parameter, a structure TooltipTextureInfo. The link provides info on possible values but does not really explain how they work.

I tried a couple of things. The best working code is when I change an anchor from LeftTop to RightTop:
Lua Code:
  1. -- Title
  2. tooltip:AddLine(label, 1, 1, 1, nil)
  3. -- Texture
  4. local tooltipTextureInfo = {
  5.     width=16,
  6.     height=16,
  7.     anchor = Enum.TooltipTextureAnchor.RightTop,
  8.     -- margin = { left = 8, right = 0, top = 0, bottom = 0 },
  9.     -- texCoords = { left = 1, right = 0, top = 1, bottom = 0 },
  10.     -- region = Enum.TooltipTextureRelativeRegion.RightLine,
  11. }
  12. local pathto = iconfolder .. iconfile
  13. tooltip:AddTexture(pathto, tooltipTextureInfo)

but it moves an icon to the end of text line. What I would like is to align an icon to right upper corner.



I asked about it on Discord and have been told GmaeTooltip may not necessarily be designed for such things. Maybe someone else in forum already had a similar problem.

Thanks.

Last edited by FranekW : 07-04-19 at 08:27 PM.
  Reply With Quote
07-04-19, 04:23 AM   #2
FranekW
A Cyclonian
 
FranekW's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 41
It turns out I had to use GameTooltip:AddDoubleLine() instead to create two columns. Also, in TooltipTextureInfo I changed "region" to "RightLine" to make an icon appeared at the right column. Now everything seems to work. This is the code:

Lua Code:
  1. -- Title
  2. tooltip:AddDoubleLine(label, " ", 1, 1, 1, 1, 1, 1)
  3. -- Texture
  4. local tooltipTextureInfo = {
  5.     anchor = Enum.TooltipTextureAnchor.RightTop,
  6.     margin = { left = 0, right = 0, top = 0, bottom = 0 },
  7.     region = Enum.TooltipTextureRelativeRegion.RightLine,
  8. }
  9. local pathto = iconfolder .. iconfile
  10. tooltip:AddTexture(pathto, tooltipTextureInfo)

Last edited by FranekW : 07-04-19 at 08:26 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Textures in GameTooltip

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off