Quantcast
WoWInterface - View Single Post - Help with code to apply !Beautycase borders
View Single Post
02-14-20, 12:19 PM   #3
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 262
Originally Posted by Fizzlemizz View Post
Being a custom panel builder KG won't actually create panels until some deferred time (probably at PLAYER_ENTRING_WOLRD or possibly PLAYER_LOGIN)

ADDON_LOADED will fire for your addon and every addon that loads after that and well before PLAYER_ENTRING_WOLRD so KG is unlikely to have created any panels by then. VARIABLES_LOADED falls into the same early call problem and will add to the error count.

Your KG panels are most likely being skinned because your frame receives its PLAYER_ENTRING_WOLRD event after KG has done initial setup so it actually works that time.
Thank you for the excellent explanation Fizzlemizz!

I removed the lines below and I am left with beautifully bordered frames, as well as no errors. Thanks!

What I removed:

Lua Code:
  1. f:RegisterEvent("VARIABLES_LOADED")
  2. f:RegisterEvent("ADDON_LOADED")

My code as of now for future reference to anyone searching for the same thing:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  3.  
  4. f:SetScript("OnEvent", function(self)
  5.  
  6.     -- Pitbull4 borders --
  7.  
  8.     if IsAddOnLoaded("Pitbull4") then
  9.         f:SetScript("OnUpdate", function(self)
  10.             for _, pitframes in pairs({
  11.                 PitBull4_Frames_Player,
  12.                 PitBull4_Frames_Target,
  13.             }) do
  14.                 if pitframes:IsShown() then
  15.                     pitframes:CreateBeautyBorder(14)
  16.                     pitframes:SetBeautyBorderPadding(3)
  17.                 end
  18.             end
  19.         end)
  20.     end
  21.  
  22.     -- kgPanels borders --
  23.    
  24.     if IsAddOnLoaded("kgPanels") then
  25.         kgPanel1:CreateBeautyBorder(14)
  26.         kgPanel1:SetBeautyBorderPadding(0)
  27.         kgPanel2:CreateBeautyBorder(14)
  28.         kgPanel2:SetBeautyBorderPadding(0)
  29.         kgPanel3:CreateBeautyBorder(14)
  30.         kgPanel3:SetBeautyBorderPadding(0)
  31.         kgPanel4:CreateBeautyBorder(14)
  32.         kgPanel4:SetBeautyBorderPadding(0)
  33.     end
  34.  
  35. end)
  Reply With Quote