View Single Post
09-05-10, 06:14 PM   #1
Wildbreath
A Cyclonian
 
Wildbreath's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 46
How to make Auction main frame movable and protected for close

Hi!
lua Code:
  1. local eventframe = CreateFrame("frame")
  2. eventframe:RegisterEvent("ADDON_LOADED")
  3. eventframe:SetScript("OnEvent", function(self, event, addon)
  4.     if addon == "Blizzard_AuctionUI" then
  5.         AuctionFrame:SetMovable(true)
  6.         AuctionFrame:SetClampedToScreen(true)
  7.         AuctionFrame:SetScript("OnMouseDown", function(self) self:StartMoving() end)
  8.         AuctionFrame:SetScript("OnMouseUp", function(self) self:StopMovingOrSizing() end)
  9.  
  10.         local handleAuctionFrame = function(self)
  11.             if AuctionFrame:GetAttribute("UIPanelLayout-enabled") then
  12.                 if AuctionFrame:IsVisible() then
  13.                     AuctionFrame.Hide = function() end
  14.                     HideUIPanel(AuctionFrame)
  15.                     AuctionFrame.Hide = nil
  16.                 end
  17.                 AuctionFrame:SetAttribute("UIPanelLayout-enabled", nil)
  18.             else
  19.                 if AuctionFrame:IsVisible() then
  20.                     AuctionFrame.IsShown = function() end
  21.                     ShowUIPanel(AuctionFrame)
  22.                     AuctionFrame.IsShown = nil
  23.                 end
  24.             end
  25.         end
  26.         hooksecurefunc("AuctionFrame_Show", handleAuctionFrame)
  27.         hooksecurefunc("AuctionFrame_Hide", handleAuctionFrame)
  28.      
  29.       self:UnregisterEvent("ADDON_LOADED")
  30.       self:SetScript("OnEvent", nil)
  31.     end
  32. end)

Last edited by Wildbreath : 09-05-10 at 10:37 PM.
  Reply With Quote