Thread: Event Chaining
View Single Post
04/14/14, 01:53 PM   #2
Nogaruk
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 15
To your example, I could be wrong, but I think the problem is you're not giving it anything to do.

-- SetHandler(string handlerName, function functionRef)

When I've used handlers before I haven't had any issues, though, it is possible the ones I've needed didn't already use the event I did. I would think the way you would want to write it though, would be:

Code:
ZO_PlayerInventoryTabsButton7:SetHandler("OnMouseUp", function(self) addonName:SomeFunction() end)
If that still breaks it, you could try seeing if registering into the main mouse event will work. You'll of course have to check against what the mouse was interacting with.

EVENT_GLOBAL_MOUSE_UP (integer button, bool ctrl, bool alt, bool shift, bool command)
I believe it would be:
Code:
EVENT_MANAGER:RegisterForEvent(addonName .. "_OnMouseUp", EVENT_GLOBAL_MOUSE_UP , function(...) self:OnMouseUpHandler(...) end)

function addonName:OnMouseUpHandler(event, button, ctrl, alt, shift, command)
end
Another choice would be to change what event you want to handle. For example you could try:
Code:
ZO_PlayerInventoryTabsButton7:SetHandler("OnClicked", function(self) addonName:SomeFunction() end)
edit: forgot an example

Last edited by Nogaruk : 04/14/14 at 01:58 PM.
  Reply With Quote