View Single Post
Old 11-08-11, 10:25 AM   #25
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,495
lua Code:
  1. local FM = CreateFrame("Frame")
  2. FM:RegisterEvent("PLAYER_LOGIN")
  3.  
  4. local _G = _G
  5.  
  6. -- Frames to Move
  7. local MoveFrameList = {
  8.     ["MacaroonBars38"] = {parent = MerchantFrame, point = "CENTER", rpoint = "CENTER", x = 0, y = 0, scale = 1},
  9. }
  10.  
  11. -- Frames to Hide
  12. local HideFrameList = {
  13.     "ExampleFrame",
  14.    
  15. }
  16.  
  17. -- Functions
  18. FM.HideAllFrames = function()
  19.     for i,v in pairs(HideFrameList) do
  20.         local f = _G[v]
  21.         if f then
  22.             f:UnregisterAllEvents()
  23.             f:Hide()    
  24.             f.Show = function() end
  25.         end
  26.     end
  27. end
  28.  
  29. FM.MoveAllFrames = function()
  30.     for i,v in pairs(MoveFrameList) do
  31.         local t = MoveFrameList[i]
  32.         local f, p = _G[i]
  33.         if f then
  34.             p = t.parent and _G[t.parent] or f:GetParent()
  35.             f:ClearAllPoints()
  36.             f:SetPoint(t.point, p, t.rpoint, t.x, t.y)
  37.             f:SetScale(t.scale)
  38.             f.SetPoint = function() end
  39.         end
  40.     end
  41. end
  42.  
  43. FM:SetScript("OnEvent", function()
  44.     FM.MoveAllFrames()
  45.     FM.HideAllFrames()
  46. end)
__________________
Nibelheim is offline   Reply With Quote