From affdbef5c11a1e0f8ab2ed36c090b3f6f5e24385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tekkub=20=CA=95=20=C2=B4=E1=B4=A5=60=20=CA=94?= Date: Sun, 11 Sep 2016 22:01:15 -0600 Subject: [PATCH] Reparent instead of doing hide/show shits --- Init.lua | 2 ++ frames/MainFrame.lua | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Init.lua b/Init.lua index 8806dc5..b29bd78 100644 --- a/Init.lua +++ b/Init.lua @@ -40,6 +40,8 @@ function ns.OnLoad() GVS:Show() end + -- Reparent the first 10 MerchantItem frames, so they only appear for buyback + for i=1,10 do _G["MerchantItem"..i]:SetParent(MerchantItem11) end -- Clean up our frame factories for i,v in pairs(ns) do if i:match("^New") then ns[i] = nil end end diff --git a/frames/MainFrame.lua b/frames/MainFrame.lua index 23a661e..b583a22 100644 --- a/frames/MainFrame.lua +++ b/frames/MainFrame.lua @@ -63,9 +63,6 @@ function ns.NewMainFrame() end) GVS:SetScript("OnEvent", Refresh) GVS:SetScript("OnShow", function(self) - -- These are used by the buyback frame, so we can't hide them forever - for i=1,12 do _G["MerchantItem"..i]:Hide() end - local max = math.max(0, GetMerchantNumItems() - NUMROWS) scrollbar:SetMinMaxValues(0, max) scrollbar:SetValue(0) @@ -75,10 +72,7 @@ function ns.NewMainFrame() GVS:RegisterEvent("MERCHANT_UPDATE") GVS:RegisterEvent("CURRENCY_DISPLAY_UPDATE") end) - GVS:SetScript("OnHide", function(self) - for i=1,12 do _G["MerchantItem"..i]:Show() end - self:UnregisterAllEvents() - end) + GVS:SetScript("OnHide", GVS.UnregisterAllEvents) return GVS end