View Single Post
01-30-18, 05:32 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
That is because you have altered the Blizzard frames in combat with your UpdateView?!

The state driver will do the show/hide for you securely.
Do not interact with the frames directly unless you have a InCombatLockdown check in place.

That being said you can write your own secure handler. Inside that handler you have access to a referenced frame if needed and have access to functions that are allowed in secure environment.

An example can be the secure page handling on actionbars I use: https://github.com/zorker/rothui/blo...r/bars.lua#L78

Lua Code:
  1. --state frame
  2. local frame = CreateFrame("Frame",nil,nil,"SecureHandlerStateTemplate")
  3. --_onstate-boss state driver
  4. for id = 1, MAX_BOSS_FRAMES do
  5.   local name = "Boss"..i.."TargetFrame"
  6.   local unitFrame = _G[name]
  7.   frame:SetFrameRef(name, unitFrame)
  8. end
  9. frame:Execute(([[
  10.   unitFrames = table.new()
  11.   for i=1, %d do
  12.     table.insert(unitFrames , self:GetFrameRef("Boss"..i.."TargetFrame"))
  13.   end
  14. ]]):format(MAX_BOSS_FRAMES))
  15. frame:SetAttribute("_onstate-boss", [[
  16.   print("_onstate-boss",newstate,unitFrames )
  17.   for i, unitFrame in next, unitFrames do
  18.     print(unitFrame:GetName(),unitFrame:IsShown())
  19.   end
  20. ]])
  21. RegisterStateDriver(frame, "boss", "[@boss5,exists,nodead]5;[@boss4,exists,nodead]4;[@boss3,exists,nodead]3;[@boss2,exists,nodead]2;[@boss1,exists,nodead]1;0")
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-30-18 at 06:01 AM.
  Reply With Quote