WoWInterface - View Single Post - How can I hooksecurefunc with colon like this: "MainMenuBarMixin:OnShow"
View Single Post
08-19-18, 04:53 PM   #3
Nikita S. Doroshenko
A Cyclonian
Nikita S. Doroshenko's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 44
Originally Posted by Kanegasi View Post
Anything with "mixin" in it's name isn't actually used directly, so if you were to hook that function, the hook won't get called. You'll need to hook the actual method on the frame that uses the mixin.

Mixins are a template of methods that frames then inherit. Blizzard gives frames a mixin template in two ways: calling frame = CreateFromMixins(mixin) or in xml using the mixin="" attribute. In this case, MainMenuBar gets its methods from MainMenuBar.xml:

XML Code:
  1. <Frame name="MainMenuBar" enableMouse="true" parent="UIParent" mixin="MainMenuBarMixin">

You should be able to do this:

Lua Code:
  1. hooksecurefunc(MainMenuBar, "SetPositionForStatusBars", Test)

Kanegasi you saved my day! Thank you very much for explanation.

I hope this thread will be helpful for all beginners or coming back modders.
Very appreciate your help.

I think it's new thing from Legion maybe, don't remember mixins in Pandaria-Warlords of Draenor.
  Reply With Quote