WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Addon to change the parent frame. (https://www.wowinterface.com/forums/showthread.php?t=41750)

Aanson 11-05-11 07:27 PM

Addon to change the parent frame.
 
I use Move Anything which allows me to change the anchor frame for new frames created for my UI, but is there an addon that allows me to change the parent frame?

Any help on this would be greatly appreciated.

Thanks :)

Seerah 11-05-11 08:30 PM

No, not that I know of... What exactly are you trying to accomplish?

Aanson 11-06-11 12:10 AM

Quote:

Originally Posted by Seerah (Post 246892)
No, not that I know of... What exactly are you trying to accomplish?

Thanks very much for your response :)

I'm building my own interface and there have been a couple of times where it would be very handy.

A good example is for a button to appear next to AuctionFrame when I open the Auction House. A macro allowing me to accept the "Buyout action?" popup box would be added to this button, and it would be bound to middle mouse button click.

I also use the same mouse button for combat, and for other actions while not in combat and not viewing the auction house.

Everything is in place already. The only hurdle that I've encountered is not being able to have the button only show when AuctionFrame is up.

Ultimately, I need to be able to assign parent frames to my new frames rather than them just being the default 'UIParent'.

Any help you could give with this would be great. Thanks again for taking the time out.

Seerah 11-06-11 01:56 PM

Wait, so are these buttons/frames that you are creating yourself? Or part of the default UI? Or...

If you're making them yourself, just use the parent frame you desire rather than UIParent when doing CreateFrame().

Otherwise, you can also use frame:SetParent("parent")

Aanson 11-06-11 05:39 PM

Quote:

Originally Posted by Seerah (Post 246914)
Otherwise, you can also use frame:SetParent("parent")

God no, I'm not an addon author by any means. Apologies if I gave that impression!

I have got pretty good at manipulating the UI using addons like MoveAnything and kgPanels etc though.

I use an action bar addon called Macaroon (which is incredible).

I've created a new bar with 1 standard button on it. Ultimately, all I'd like to do is change it's parent frame.

Do you think I'd be able to go into the .lua and change it there using the above line of code that you kindly suggested? If so, is it important at what point in the existing button code I slot it in?

Now that I think about it, it must already be parented to UIParent surely. I'll have a go at finding the appropriate line of code.

Thanks again for your time so far and wish me luck!!! (Bet I end up breaking something lol)

Lily.Petal 11-06-11 05:41 PM

Link in my sig gives a easy-to-use Lua based addon that does this~ Thanks to Nib ;D

All you do is copy the example, and /fstack the frame you want to move, and then put it in and change where you want to put it. Nice and easy~

Called Lua Based UI Hider, it hides things as well as moving them, and only hides/moves what you want to. (two different example lines to show you how)

Aanson 11-06-11 06:18 PM

Quote:

Originally Posted by Lily.Petal (Post 246927)
Link in my sig gives a easy-to-use Lua based addon that does this~ Thanks to Nib ;D

All you do is copy the example, and /fstack the frame you want to move, and then put it in and change where you want to put it. Nice and easy~

Called Lua Based UI Hider, it hides things as well as moving them, and only hides/moves what you want to. (two different example lines to show you how)

I had a good look at the examples in the forum that your link takes me to. I couldn't for the life of me find the addon you were referring to though sorry!

The code in your posts looks a little like what I'm after, but I'd not have the faintest idea where to put it or what to do with it lol!!

Thanks for the suggestion :)

Nibelheim 11-06-11 06:36 PM

Link

Just insert your frames at the top of Core.lua, you'll find it.

Aanson 11-06-11 08:18 PM

Quote:

Originally Posted by Nibelheim (Post 246930)
Link

Just insert your frames at the top of Core.lua, you'll find it.

I think what I need to do is change the .lua in the Macaroon addon (as the button i want to change the parent for is created by Macaroon).

I'm just not sure what code to use or where exactly to put it!

It would be amazing if you could give me an example of code and perhaps let me know where to put it. That way I'd have a template to work from for other UI changes.

Please let me know if there is any information that you need and thanks so much for taking the time out.

EDIT: God I'm an idiot. Just noticed that you'd given me the link for your addon! I've downloaded it and I'll check it out tomorrow after work. Thank you!

Aanson 11-08-11 11:20 AM

Quote:

Originally Posted by Nibelheim (Post 246930)
Link

Just insert your frames at the top of Core.lua, you'll find it.

I'm not sure if I've done what you suggested correctly. I'd downloaded your addon, bumped the .toc and added the bit of code to the top like you said. I logged on but it didn't seem to change anything.

I'm pretty sure that there's a HUGE chance that I've either put it in the wrong place or done something else wrong!!!

Please help moi!!




PHP Code:

local MoveFrameList = {
    [
"MacaroonBars38"] = {parent MerchantFramepoint "CENTER"rpoint "CENTER"00scale 1},

local FM CreateFrame("Frame")
FM:RegisterEvent("PLAYER_LOGIN")

local _G _G

-- Frames to Move
local MoveFrameList 
= {
    [
"ExampleFrame"] = {parent nilpoint "CENTER"rpoint "CENTER"00scale 1},
    
}

-- 
Frames to Hide
local HideFrameList 
= {
    
"ExampleFrame",
    
}

-- 
Functions
FM
.HideAllFrames = function()
    for 
i,v in pairs(HideFrameList) do
        
local f _G[v]
        if 
f then
            f
:UnregisterAllEvents()
            
f:Hide()    
            
f.Show = function() end
        end
    end
end

FM
.MoveAllFrames = function()
    for 
i,v in pairs(MoveFrameList) do
        
local t MoveFrameList[i]
        
local f_G[i]
        if 
f then
            p 
t.parent and _G[t.parent] or f:GetParent()
            
f:ClearAllPoints()
            
f:SetPoint(t.pointpt.rpointt.xt.y)
            
f:SetScale(t.scale)
            
f.SetPoint = function() end
        end
    end
end

FM
:SetScript("OnEvent", function()
    
FM.MoveAllFrames()
    
FM.HideAllFrames()
end



All times are GMT -6. The time now is 02:50 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI