Thread Tools Display Modes
08-26-20, 08:32 PM   #1
Banthur
A Defias Bandit
Join Date: Jun 2009
Posts: 2
Overriding stuff mixed in

I'm trying to prevent the pvp match results scoreboard from showing

PVPMatchResults:SetScript("OnEvent", onevents);

even with this though - the event that triggers it is still firing on the original blizzard ui code and the frame is showing

Both my function and the original are called

is SetScript supposed to replace a handler or add one?
I've also tried SetScript("OnEvent", nil) --original still called

maybe it is because the original frame is using a mixin for its handlers?
how do I overwrite or nil out a mixin's callbacks?
  Reply With Quote
08-27-20, 12:27 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Try:
Code:
PVPMatchResults.Onevent = onevents
and don't use:
Code:
PVPMatchResults:SetScript("OnEvent", onevents);
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-27-20, 04:00 PM   #3
Banthur
A Defias Bandit
Join Date: Jun 2009
Posts: 2
Originally Posted by Fizzlemizz View Post
Try:
Code:
PVPMatchResults.Onevent = onevents
and don't use:
Code:
PVPMatchResults:SetScript("OnEvent", onevents);
What's the difference between the assignment and SetScript? Is there one?

I tested the assignment method today and that seems to produce the effect I wanted. I also noticed something yesterday -- the code I had originally (SetScript) *was* working; it just wasn't working in my test harness.

I was using a macro
Code:
PVPMatchResults:OnEvent("PVP_MATCH_COMPLETE")
to test the response of the elements to the event. Using this however seems to always trigger the original function on the frame, I'm not sure why.
  Reply With Quote
08-27-20, 08:35 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The mixin created the method on the frame ie.

function frame:OnEvent(self, event, ...)
-- OnEvent code
end

the xml frames OnEvent <Script> tag tells it to use the frame method.

What I posted replaces the mixin method that gets applied to the frame with your new one ie. it just overrides the old function with the new.

Code:
PVPMatchResults:OnEvent("PVP_MATCH_COMPLETE")
That's directly calling the method applied (copied) to the frame by the mixin (the one that is overwritten by the code in my original reply).

Code:
PVPMatchResults:GetScript("OnEvent")(PVPMatchResults, "PVP_MATCH_COMPLETE")
Call the function currently assigned to the script.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-27-20 at 10:19 PM.
  Reply With Quote
08-29-20, 01:46 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by Fizzlemizz View Post
Try:
Code:
PVPMatchResults.Onevent = onevents
and don't use:
Code:
PVPMatchResults:SetScript("OnEvent", onevents);
You can get away with this on dynamic frames, but the update doesn't work on functions already set as a handler. You still have to use :SetScript() to update those.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 08-29-20 at 01:53 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Overriding stuff mixed in

Thread Tools
Display Modes

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