WoWInterface - View Single Post - How can I hooksecurefunc with colon like this: "MainMenuBarMixin:OnShow"
View Single Post
08-19-18, 07:39 PM   #4
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
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)

It's interesting to me that you would say that, because this works for me:

lua Code:
  1. hooksecurefunc(ExpBarMixin, "Update", function(self)
  2.     TextStatusBar_UpdateTextString(self)
  3.     self:ShowText(self)
  4.     self:UpdateCurrentText()
  5. end)

Maybe it depends on the mixin? idk
  Reply With Quote