Thread Tools Display Modes
09-29-06, 03:00 AM   #1
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Is it possible to add a personalized tooltip to a macro ?

Hi :P

I was wondering if I can add a personalized tooltip to my macro.
I found the event triggered when the cursor is over an unit, but i can't find the even triggered when the cursor is over a macro. I know how to make the tooltip and add it to the gametooltip, I'm just looking for a way to know that cursor is over the actionbar and in what actionbutton. Something like the "UPDATE_MOUSEOVER_UNIT" event but for the actionbar and respective action button :P

Thank You for reading this posts and try to help me out
Cheers
  Reply With Quote
09-29-06, 06:59 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
There's no game event when you mouseover macros on an action bar. The action bar itself generates the tooltip by calling GameTooltip:SetAction(slot). So to add your own info to the macro you can hook that:

Code:
local o=GameTooltip.SetAction
function GameTooltip.SetAction(self,slot)
  o(self,slot)
  if GetActionText(slot) then
    GameTooltip:AddLine("I'm a macro")
  end
end
You'll note that GameTooltip:SetAction(slot) has one parameter and the hook has two. This is because we're changing : notation to .

GameTooltip:SetAction(slot) == GameTooltip.SetAction(self,slot)

edit: I'm missing something because I just tried it and the tooltip isn't resizing to accomidate the new text. Unfortunately I have to go out the door but I'll check this later today if nobody else knows why.

Last edited by Gello : 09-29-06 at 07:08 AM.
  Reply With Quote
09-30-06, 05:22 AM   #3
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Thks for your help m8 :P Most of my posts here are answerd by you, so REALLY REALLY Thank You

I still have a doubt, althou I haven't try it yet, from what or where shall I call that funciton?
How can I hook it to the actionbar?

I'm really sorry for my noobiness :P
  Reply With Quote
09-30-06, 07:19 AM   #4
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
You run that code only once per session. The OnLoad or PLAYER_LOGIN are good places since they happen one time at the start of a session. Technically you don't even need those:

ImAMacro.toc
## Interface: 11200
## Title: ImAMacro
ImAMacro.lua

ImAMacro.lua
local o=GameTooltip.SetAction
function GameTooltip.SetAction(self,slot)
o(self,slot)
if GetActionText(slot) then
GameTooltip:AddLine("I'm a macro")
end
end

However I think this is the wrong approach. I can get the tooltip to resize by adding the text at the OnShow, but that's kludgy.
  Reply With Quote
09-30-06, 12:51 PM   #5
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Ok. Gonna give it a try.

Thank You again for your help :P
  Reply With Quote
10-04-06, 08:18 AM   #6
ProfOak
A Cyclonian
Join Date: Oct 2005
Posts: 47
Well, it works, but...

I didn't understand to what "OnShow" you refered to, since i don't have a particular frame on were to use this, so I added your code to a file that is loaded by the addon.
I see the message when the cursor is over a macro but it doesn't overwritte gametooltip, it appears below the gametooltip.
I have either to make the gametooltip from scratch or to use GameTooltip_AddNewbieTip builtin function.
Did I made everything ok ? Or I missed to understand what I was supposed to do ?

Sorry :P And Thks
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is it possible to add a personalized tooltip to a macro ?


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