WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Tutorials & Other Helpful Info. (https://www.wowinterface.com/forums/forumdisplay.php?f=12)
-   -   How to make Auction main frame movable and protected for close (https://www.wowinterface.com/forums/showthread.php?t=34813)

Wildbreath 09-05-10 06:14 PM

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)

Sythalin 09-05-10 08:03 PM

Change your highlight to "lua" instead of the default (highlight=lua). The coloring for the PHP is terrible. ;)

Are you asking how to do it, what's wrong with your code (it does have an error I noticed) or just a guide? Lack of ending punctuation in your subject leaves this question.

As far as the error, you're missing brackets around your UnregisterEvent param.

Code:

self:UnregisterEvent("ADDON_LOADED")

Seerah 09-05-10 08:32 PM

Chaos, Wildbreath has posted this as working code for others to use. He has a few tutorials/guides in this forum ("Tutorials & Other Helpful Info.").

Also, parentheses aren't needed there.

Wildbreath 09-05-10 10:21 PM

Sorry for php code :o
how to change highlight? forum options or "CODE" param?
(fixed brackets)

Seerah 09-05-10 10:36 PM

Instead of just [highlight], do [highlight=lua]. The closing tag is the same (just /highlight)

Wildbreath 09-05-10 10:38 PM

Thanks, Seerah :)

also fixed a
http://www.wowinterface.com/forums/s...ad.php?t=33236
http://www.wowinterface.com/forums/s...ad.php?t=33235


All times are GMT -6. The time now is 05:54 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI