Thread Tools Display Modes
01-29-20, 10:19 AM   #1
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
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
01-30-20, 12:15 AM   #2
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Originally Posted by jeruku View Post
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)
  5.     if event == 'Blizzard_AzeriteEssenceUI' then
  6.         --AzeriteEssenceUI
  7.         local MAEU = AzeriteEssenceUI
  8.         MAEU.ClearAllPoints = function() end
  9.         MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5)
  10.         MAEU.SetPoint = function() end
  11.         MAEU:SetMovable(true)
  12.         MAEU:SetUserPlaced(true)
  13.         MAEU:SetClampedToScreen(true)
  14.          
  15.         local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU)  
  16.         MoveAzeriteEssenceUI:SetHeight(15)
  17.         MoveAzeriteEssenceUI:ClearAllPoints()
  18.         MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU)
  19.         MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU)
  20.         MoveAzeriteEssenceUI:EnableMouse(true)
  21.         MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5)
  22.         MoveAzeriteEssenceUI:RegisterForDrag("LeftButton")
  23.         MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button)
  24.             if button=="LeftButton" and IsModifiedClick()then
  25.                 MAEU:StartMoving()
  26.             end
  27.         end)
  28.         MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button)
  29.             MAEU:StopMovingOrSizing()
  30.         end)
  31.         --AzeriteEssenceUI
  32.     end
  33. end)

Doing multiple LOD objects:
Lua Code:
  1. EventFrame:SetScript('OnEvent', function(self, event)
  2.     if event == 'Blizzard_AzeriteEssenceUI' then
  3.         --AzeriteEssenceUI
  4.     elseif event == 'Blizzard_InsertNameHere' then
  5.         --InserNameHereUI mover code
  6.     end
  7. end)
I can no longer move a frame with the lua code. There is no error message, but moving the frames is no longer possible.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Error on Move Frame Addon


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