Move an element?

I used addon.bool.no to create a tiny addon to hide the bag button, but can someone tell me the format for moving the micro menu? I believe the element to target is MicroButtonAndBagsBar, I want to move the whole thing, but don’t know the syntax. I could mess around with the X Y coordinates if I knew it.

thanks!

MicroButtonAndBagsBar:ClearAllPoints()
MicroButtonAndBagsBar:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0)

UIParent is “the screen”

The 1st TOPLEFT is TOPLEFT of the MicroButtonAndBagsBar, the second is the point on UIParent to anchor it to.

0, 0 is the x, y

I’m surprised this isn’t part of EditMode, but I haven’t found it (or bothered searching the code for it).

Thank you!! Really appreciate the help

Hey Fizzlemizz! I see you know your Lua pretty well so I was wondering if you could help me with a simple problem I’m trying to figure out.

I’m just trying to move the buff and debuff bar / icons for the default Target frame to where I would like them to be.

The Frame I’m getting is TargetFrame.spellBarAnchor. If I use the add-on frame inspect it let’s me move it but just as a test not permanent.

I tried using different Lua codes like :SetAlpha(0) but it’s not doing anything :person_shrugging:

no blizzard controlled frame that you move will stay where you leave it. it will be repositioned at the next login (because blizzards code sets it there).

to get around that you have to reset its position each login as well - same as OP does via a small addon youd write that contains the commands to move the frame.

1 Like

The buff frames are repositioned each time your buffs/debuffs update. You would have to hook the TargetFrame_UpdateBuffAnchor function, but there is a lot of conditional positioning going on. The first buff is anchored to the frame, and then the rest of the buffs are anchored to eachother. This for example will put them all in the middle of your screen, but in the original row layout, and also bring the debuffs and cast bar (unless you select “Buffs On Top” for your TargetFrame in EditMode) along with it.

hooksecurefunc("TargetFrame_UpdateBuffAnchor", function(self, buff, index)
    if index == 1 then
        buff:ClearAllPoints()
        buff:SetPoint("CENTER", UIParent)
    end
end)

https://github.com/Gethe/wow-ui-source/blob/10.0.0/Interface/FrameXML/TargetFrame.lua#L690

1 Like

Thank you for the learning process! So if I use this code would I need a
x y setpoint after to change the position?
You know like a number for x and number for y after

Those are optional arguments for the SetPoint in that hook, just add some arguments there.

region:SetPoint(point [, ofsx, ofsy])
region:SetPoint(point, relativeTo [, ofsx, ofsy])
region:SetPoint(point, relativeTo, relativePoint [, ofsx, ofsy])

1 Like

Awesome :grin: you make it sound so easy lol. I really appreciate the help! :pray::pray::pray: I’ll try it out later when I get off work! :+1: If I run into any problems is it okay to reply? But you have it pretty crystal clear in the code so I don’t think I’ll run into any issues :joy:

Yeah I figured it was kinda like that and I was missing a important hook about it :joy:

If you are want to change one x/y offset, then set both so the function knows which one you are wanting.

1 Like

Can you show me what it would look like in code for an example? I’d probably would figure it out if I was in Lua right now but I’m at work :smile:

You guys are awesome and I’m looking forward getting right on it when I get home :+1:

I missed the OP. The target buff/debuff frames are constantrly being re-anchored when auras a added/removed, target changed etc. to take into account things like the frames being anchored above/below. The position of each aura is dependant this as well.

So does that mean it’s not possible to move them? I’m about to get into lua

The only other thing I can think of is if it’s possible to set the frame alpha to 0 and just use Weakauras for the target buffs to move.

Problem is which frame would make that possible :thinking:

TargetFrame.TargetFrameContent.TargetFrameContentContextual.buffs
and
TargetFrame.TargetFrameContent.TargetFrameContentContextual.debuffs

If I remember correctly (and I don’t know if this has changed with pre-patch) you hook
TargetFrame_UpdateBuffAnchor
and
TargetFrame_UpdateDebuffAnchor
and reset the anchors there.

I’m not sure if this is going to cause taint in the curent patch. If it does, it “might” get better with the actual DF launch.

So Far I tried

hooksecurefunc(“TargetFrame_UpdateBuffAnchor”, function(self, buff, index)
if index == 1 then
buff:ClearAllPoints()
buff:SetPoint(“CENTER”, UIParent)

Then Tyreith said Those are optional arguments for the SetPoint in that hook, just add some arguments there.

region:SetPoint(point [, ofsx, ofsy])
region:SetPoint(point, relativeTo [, ofsx, ofsy])
region:SetPoint(point, relativeTo, relativePoint [, ofsx, ofsy])
end
end)
Where Would I put in the numbers on that? Where it says point?
I’m not good at lua yet enough to figure this out.
It’s tricky.
On Frame inspect it’s called TargetFrame.spellbarAnchor which moves the whole frame with the other buffs. So I’m kinda baffled at this point lol.

hooksecurefunc("TargetFrame_UpdateBuffAnchor", function(self, buff, index)
	if index == 1 then
		buff:ClearAllPoints()
		buff:SetPoint("TOPLEFT", UIParent, "CENTER", 50, 0)
	end
end)
hooksecurefunc("TargetFrame_UpdateDebuffAnchor", function(self, buff, index)
	if index == 1 then
		buff:ClearAllPoints()
		buff:SetPoint("TOPLEFT", UIParent, "CENTER", -50, 0)
	end
end)

The TOPLEFT is the TOPLEFT of the first buff/debuff icon anchoring to the CENTER of UIParent (the screen) then x and y offsets (buffs to the right of centre and debuffs to the left).

Not sure how tainty it will be.

1 Like

I’ll work with it for awhile see what I get. I’ll give you a heads up on progress :+1:

You’ll want to change the if lines to

if self.unit == "target" and index == 1 then

The function is also used for Focus and Boss frames.

1 Like