Reply
Thread Tools Display Modes
Unread 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.
Wildbreath is online now   Reply With Quote
Unread 09-05-10, 08:03 PM   #2
ChaosInc
Curse staff
 
ChaosInc's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 670
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")
__________________
Originally posted by Mirrikat45
so says the 1/2 million downloads per week.......
Impossible statistics = FAIL!! But don't point this out, or your post will be deleted!

Last edited by ChaosInc : 09-05-10 at 08:07 PM.
ChaosInc is offline   Reply With Quote
Unread 09-05-10, 08:32 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,627
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.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 09-05-10, 10:21 PM   #4
Wildbreath
A Cyclonian
 
Wildbreath's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 46
Sorry for php code
how to change highlight? forum options or "CODE" param?
(fixed brackets)
Wildbreath is online now   Reply With Quote
Unread 09-05-10, 10:36 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,627
Instead of just [highlight], do [highlight=lua]. The closing tag is the same (just /highlight)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

Seerah is offline   Reply With Quote
Unread 09-05-10, 10:38 PM   #6
Wildbreath
A Cyclonian
 
Wildbreath's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 46
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

Last edited by Wildbreath : 09-05-10 at 10:41 PM.
Wildbreath is online now   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » How to make Auction main frame movable and protected for close

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off