in your browser.
My own tooltip is just almost working
Return to board index
For one of my addons I created a tooltip which i fill with :SetHyperlink(link).
I have onw big window, containing up to 20 smaller ones, each representing a spell. I want the tooltip to show, and be filled with the spell, whenever I mouseover one of the small windows. When I mouseover it's filled and shown exactly as I want to. But here starts the problems.
I want the tooltip to hide when I leave each window, so I started by adding :Hide() on each small frames "OnLeave", this hides it but makes it impossible to show again ("OnEnter"). If I remove the hiding, the tooltip changes to the right spells when I mouseover new ones, but once I leave the big frame the tooltip becomes blank from :ClearLines() but keeps following the mouse.
I tried putting the :Hide() on the main frame's "OnLeave". The tooltip just flashes and the dissapear.
It seems like everytime I hide it, I can't show it again.
Is there something special you have to do with tooltips for them to behave themselves, or should I provide my code?
Provide your code. You're definitely hitting a bug somewhere. I'm using :SetHyperlink('spell:#') for my own cooldown display, and a simple :Show() @ OnEnter and :Hide() @ OnLeave functions just as expected.
Also, clarify if you're using your own tooltip frame instead of GameTooltip? If so,
. I personally consider this bad practice. It's pointless to have more than 1 standard tooltip, since you'll only ever be mousing over 1 thing at a time. Having an extra custom tooltip only means more work for you, and more annoyance for users when their tooltip customizations don't apply to yours.
. :Show() @ OnEnter is not correct. Tooltips don't work that way. They work on the basis of ownership. Just replace your :Show() line with
. This will automatically show it. No special logic when you're done, just :Hide() and the tooltip takes care of the rest. Here's an example from my code mentioned above:
I was using a tooltip made from the GameTooltipTemplate, but after I did the changes you mentioned, it still doesn't work (With or without the :Show())
edit: for some reason the indents doesn't work... hope you can read it anyway
for i = 1,76 do
f.items = CreateFrame("Button","NewSpell"..i,f)
if mod(i-1,4) == 3 then
anchor.x = 15
anchor.y = anchor.y - 30
anchor.x = anchor.x + 83
f.items:SetHitRectInsets(0, -50, 0, 0)
f.items.icon = f.items:CreateTexture()
f.items.text = f.items:CreateFontString(nil,nil,"GameFontNormal")
f.items.highlight = f.items:CreateTexture("OVERLAY")
if button == "LeftButton" then
print("Added "..GetSpellInfo(self.spell.ID).." "..self.spell.cd.." sec")
print("Removed "..GetSpellInfo(self.spell.ID).." "..self.spell.cd.." sec")
It could be related to the following errors:
f.items.icon = f.items:CreateTexture() -- you need to pass args, eg (nil,'BORDER')
f.items.text = f.items:CreateFontString(nil,nil,"GameFontNormal") -- you need to pass a draw layer, eg (nil,'ARTWORK','GameFontNormal')
f.items.highlight = f.items:CreateTexture("OVERLAY") -- You're passing OVERLAY as name. Put a nil in front of it.
Also, on .highlight, set the layer as "HIGHLIGHT", not overlay. If you do this, the game-engine takes care of showing/hiding it when you mouseover/mouseout. So you don't need to manually do it @ OnEnter and OnLeave.
Also, :SetOwner() may need to be called before :SetHyperlink(). I'm inclined to say it does, but I don't know for sure.
Ok I will test that, thanks :)
Just FYI, if you ommit the layer in CreateFontString() it defaults for "ARTWORK" :) I did miss on the texture though :P
Edit: Thanks alot! Switching the SetOwner and SetHyperlink did the trick :)
You are not logged in. Please
to post a reply or
if you don't already have an account.