Originally Posted by Tiok
With "event" gone, how do we tell which event occurred in the XML-defined OnEvent handler?
how do you get access to event arguments inside the XML-defined OnEvent handler, so you can pass them through?
|
As with
self, the event and any arguments are passed to your OnEvent handler. These are identical:
Code:
local myFrame = CreateFrame("Frame", "MyFrame")
myFrame:SetScript("OnEvent", function(self, event, ...)
-- self is a reference to the frame
-- event is a string indicating which event is being handled
-- ... is a vararg containing any and all arguments passed with the event
end)
Code:
<Frame name="MyFrame">
<OnEvent>
-- self is a reference to the frame
-- event is a string indicating which event is being handled
-- ... is a vararg containing any and all arguments passed with the event
</OnEvent>
</Frame>
As someone else already pointed out, you get the individual arguments like this:
Code:
local arg1, arg2, arg3 = ...