I have 2 anchors that share a menu with some buttons. When the mouse enter an anchor, the menu is shown next to it and each button "target-slot" attribute is set depending of the anchor (16/17 for MH/OH).
anchor:SetAttribute( "_onenter", [[
local buttons = newtable( menu:GetChildren() )
for _, button in next, buttons do
button:SetAttribute( "target-slot", slot )
local showBelow = select( 2, self:GetRect() ) > uiparent:GetHeight() / 2
menu:SetPoint( showBelow and "TOP" or "BOTTOM", self, showBelow and "BOTTOM" or "TOP" )
Out of combat it works properly. But in combat "menu:GetChildren()" returns nothing.
My buttons inherit SecureActionButtonTemplate and SecureHandlerEnterLeaveTemplate (and SecureHandlerClickTemplate that override "type" attribute for debug purpose) but they seem treated like unsecure frames. Am I doing something wrong or is it a bug ?
Steps to reproduce:
1. download the test addon attached to this post and install it your wotlk addons folder.
2. launch the game and log a character. You should see the buttons "Anchor 16" and "Anchor 17" (and the shared menu with random crap).
3. hover an anchor and click an item in the adjacent menu.
4. hover the other anchor and click an item in the adjacent menu. target-slot numbers should be different.
5. enter combat and redo step 3 & 4. Target-slot numbers are the same.
I replaced "local buttons = newtable( menu:GetChildren() )" with "buttons = buttons or newtable( menu:GetChildren() )" and added:
menu:RegisterEvent( "PLAYER_REGEN_DISABLED" )
menu:SetScript( "OnEvent", function(self, event)
for _, anchor in next, anchors do
anchor:Execute( [[ buttons = newtable( menu:GetChildren() ) ]] )
This loop makes me wonder if there's a way to only have one restricted environment for all secure frames in a single addon. Would avoid too many SetFrameRef/GetFrameRef/Execute and associated operations like parsing/loadstring.
Anyway, is there someone with an US account that could ask Alestane/Iriel about these matters please ?