Global_mouse_up/LUA trigger question

Heya folks, I’ve just started trying to make an addon for wow. I think I grasp the basics but I have a few questions based on events.

I wanted to use UPDATE_CHAT_WINDOWS to trigger an event thinking this would trigger each time a chat tab is selected. however in practice it seems to not trigger whenever your tab changes.

Looking at the event log the only event that triggers when you click on chat tab is the mouse GLOBAL_MOUSE_UP/DOWN.

Is it bad practice to run something on that event? Is there maybe a better trigger event for this task?

When a tab is clicked it calls the FCF_Tab_OnClick function. Probably easier to hook that depending on what it is you are wanting to do and assuming you only want to do it when a chat tab is clicked.

hooksecurefunc("FCF_Tab_OnClick", function(self, button)
    print("Clicked:", "Chat Frame:", self:GetParent():GetName(), "Tab ID:", self:GetID())
end)

How did you know this is the event that’s firing?
I checked myself and /etrace only shows GLOBAL_MOUSE_UP/DOWN, just as OP mentioned.

It’s not an event, it’s a function called when the mouse clicks the tab. /etrace shows something was clicked, but not the specifics of what was clicked (/fstack will show what is under the mouse at the time) and what happens when it is. To do that you need to look at the code for the game UI:

Open the file:
BlizzardInterfaceCode\Interface\FrameXML\FloatingChatFrame.xml

Find the XML for the ChatTabTemplate and see what if does in the OnClick handler.

1 Like