Thread Tools Display Modes
06-22-08, 01:53 PM   #1
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Tooltip issues

Basically when using
Code:
GameTooltip:AddLine("Right click to remove "..name")
I get this (without concatenation):




Heres all my code
Code:
local function ShowItemTooltip(self)
	GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
	if self.id then
		local name, link = GetItemInfo(self.id)
		GameTooltip:SetHyperlink(link)
		GameTooltip:AddLine("Right click to remove "..name")
	else GameTooltip:SetText("Drag an item here", nil, nil, nil, nil, true)
	end
end
Any ideas?
  Reply With Quote
06-24-08, 07:20 PM   #2
Everglow
An Aku'mai Servant
 
Everglow's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Not sure what you need help with, Slakah. I see a few different things. I'm guessing that's not actually the code you have, but rather something more like this (minus the line in red):

Code:
 
local function ShowItemTooltip(self)
   GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
   if self.id then
      local _, link = GetItemInfo(self.id)
      GameTooltip:SetHyperlink(link)
      GameTooltip:AddLine("Right click to remove this item")
   else
      GameTooltip:SetText("Drag an item here", nil, nil, nil, nil, true)
   end
   GameTooltip:Show()
end
If you add the line in red, the borders will adjust to fit your text. Is that the issue you posted about?
__________________
Everglow - Sisters of Elune/US
  Reply With Quote
06-24-08, 11:24 PM   #3
VagrantEsha
Token Werewolf Fan
 
VagrantEsha's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 27
I've seen this, sometimes the tooltip is stubborn about resizing to fit the new line. Sometimes it's the cause of a mod, sometimes it happens naturally. The tooltip can be a very volatile thing.

Does that improper resizing of the tooltip's backdrop happen everywhere, Slakah, or just for that button? If it happens everywhere then the simple option would be to figure out the size of the font-string in the code and resize the tooltip whenever the line is added, so that the tooltip size includes the size of the added line. You could also use a library like LibGratuity-3.0 to do this easily, I suppose.
  Reply With Quote
06-25-08, 05:38 AM   #4
jaliborc
A Chromatic Dragonspawn
 
jaliborc's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 196
Tooltips don't automatically resize themselves when you add text to them. To 'force' a size update, you have to call the 'Show' function.
  Reply With Quote
06-25-08, 06:17 AM   #5
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Ahhh I just assumed the tooltip would auto resize when adding a new line.

Thanks for the help!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Tooltip issues


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