Originally Posted by Aanson
Phanx ... I've been looking for a very long time for a way to change the Parent of one of my Macaroon Bars ("MacaroonBars38" in this case) so that instead of it being the generic "UIParent", it's "MerchantFrame" instead. ... Is it possible for the code you wrote below to achieve what I'm looking for? Ultimately, I'd like the bar to appear only when I open a merchant frame, and hide at all other times.
|
Just reparent the bar before the loop that runs through the bar's buttons (or instead of it).
Before:
Code:
if bar.config.buttonList then
Add:
Code:
bar:SetParent(MerchantFrame)
Be aware, however, that if you parent a secure frame (eg. an action bar or an action button) to a non-secure frame, you will encounter problems, especially while in combat. You might be better off simply hiding the bar (eg. bar:Hide()) and then hooking the merchant frame's OnShow/OnHide scripts to show/hide the bar as needed, with checks to make sure you don't try to do it while in combat.