Quantcast WoWInterface - View Single Post - Error on Move Frame Addon
View Single Post
01-29-20, 10:19 AM   #6
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 215
Edit: Thanks to Vrul who pointed out my error. I've fixed the following code for posterity.

ADDON_LOADED triggers if, as you'd assume, an addon is loaded; this includes Load-On-Demand addons, like Blizzard_AzeriteEssenceUI. I can't recall off hand what other UI objects are LOD but you can reuse the event frame for those as needed; you can check an export of the interface files for the Blizzard_Addons which include Load-On-Demand in their TOC.
You could use LoadAddOn, but loading an addon that you likely won't use for 109 levels on a level 1 is rather pointless; I'd only recommend it if it's a UI object that can be used on any level/class/race.

Lua Code:
  1. local EventFrame = CreateFrame('Frame', nil, UIParent)
  2. EventFrame:RegisterEvent('ADDON_LOADED')
  3.  
  4. EventFrame:SetScript('OnEvent', function(self, event, name)
  5.     if event == 'ADDON_LOADED' then
  6.         if name == 'Blizzard_AzeriteEssenceUI' then
  7.             --AzeriteEssenceUI
  8.             local MAEU = AzeriteEssenceUI
  9.             MAEU.ClearAllPoints = function() end
  10.             MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  11.             MAEU.SetPoint = function() end
  12.             MAEU:SetMovable(true)
  13.             MAEU:SetUserPlaced(true)
  14.             MAEU:SetClampedToScreen(true)
  15.          
  16.             local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  17.             MoveAzeriteEssenceUI:SetHeight(15)
  18.             MoveAzeriteEssenceUI:ClearAllPoints()
  19.             MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  20.             MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  21.             MoveAzeriteEssenceUI:EnableMouse(true)
  22.             MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  23.             MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  24.             MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  25.                 if button=="LeftButton" and IsModifiedClick()then
  26.                     MAEU:StartMoving()
  27.                 end
  28.             end)
  29.             MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  30.                 MAEU:StopMovingOrSizing()
  31.             end)
  32.             --AzeriteEssenceUI
  33.         end
  34.     end
  35. end)

Doing multiple LOD objects:
Lua Code:
  1. EventFrame:SetScript('OnEvent', function(self, event)
  2.     if event == 'ADDON_LOADED' then
  3.         if name == 'Blizzard_AzeriteEssenceUI' then
  4.             --AzeriteEssenceUI
  5.         elseif name == 'InsertUINameHere' then
  6.             --Mover code for InsertUINameHere
  7.         end
  8.     end
  9. end)

To export interface files:
  1. Head over to your WoW install folder and create a shortcut for WoW.exe
  2. Right-click the WoW shortcut and click "Properties".
  3. In the "Target" box, add -console while preserving any quotation marks that may be there. This must be placed after the quotation mark; it should look something like "C:/<Path to WoW>/WoW.exe" -- console
  4. Click "OK".
  5. Use the shortcut; this is done normally by double-clicking, or clicking once if single-click is enabled.
  6. At the login screen hit '`'; that's '~' without hitting shift. Follow further instructions here if your keyboard layout doesn't include '`'.
  7. Input "ExportInterfaceFiles code" without quotes in the console and press enter; it will take a while, I recommend not playing during this time.
  8. When complete you'll find a folder called BlizzardInterfaceCode in your WoW folder.
  9. Dig through Blizzard code to your hearts content.
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison

Last edited by jeruku : 01-30-20 at 10:51 AM. Reason: Cross your 't's and dot your 'i's.
  Reply With Quote