Originally Posted by jeruku
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:
local EventFrame = CreateFrame('Frame', nil, UIParent) EventFrame:RegisterEvent('ADDON_LOADED') EventFrame:SetScript('OnEvent', function(self, event) if event == 'Blizzard_AzeriteEssenceUI' then --AzeriteEssenceUI local MAEU = AzeriteEssenceUI MAEU.ClearAllPoints = function() end MAEU:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOM", 45, -5) MAEU.SetPoint = function() end MAEU:SetMovable(true) MAEU:SetUserPlaced(true) MAEU:SetClampedToScreen(true) local MoveAzeriteEssenceUI = CreateFrame("Frame", nil, MAEU) MoveAzeriteEssenceUI:SetHeight(15) MoveAzeriteEssenceUI:ClearAllPoints() MoveAzeriteEssenceUI:SetPoint("TOPLEFT", MAEU) MoveAzeriteEssenceUI:SetPoint("TOPRIGHT", MAEU) MoveAzeriteEssenceUI:EnableMouse(true) MoveAzeriteEssenceUI:SetHitRectInsets(-5, -5, -5, -5) MoveAzeriteEssenceUI:RegisterForDrag("LeftButton") MoveAzeriteEssenceUI:SetScript("OnDragStart", function(self, button) if button=="LeftButton" and IsModifiedClick()then MAEU:StartMoving() end end) MoveAzeriteEssenceUI:SetScript("OnDragStop", function(self, button) MAEU:StopMovingOrSizing() end) --AzeriteEssenceUI end end)
Doing multiple LOD objects:
Lua Code:
EventFrame:SetScript('OnEvent', function(self, event) if event == 'Blizzard_AzeriteEssenceUI' then --AzeriteEssenceUI elseif event == 'Blizzard_InsertNameHere' then --InserNameHereUI mover code end 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.