parent frame...
how would you set a frame(made entirely in lua) to parent to bartender4 pet bar???
ive tried pet:SetParent("BT4PetButton1") also tried these: "PetActionBar" "PetBar" but nothing works.... someone know what to properly put in for the parent? |
You could either decipher the Bartender code to try and find the correct name, or...
In game type '/framestack' in the chat box (without quotes) and then move the mouse pointer over the pet bar. This will show the names of all the frames under the mouse pointer. Trying '/framestack' again will turn off the functionality. |
nice.. but it still comes up with the same thing....
BT4PetButton1.. etc etc ive tried that to set my frame to that parent... but it does not work. pet:SetParent("BT4PetButton1") doesnt work.... for some reason. |
Is your addon loading before Bartender? If so the parent frame you are trying to set may not exist yet.
Make sure Bartender loads before your addon by making Bartender a required dependency of your addon. |
Could you be more specific about "doesn't work"? Does your code trigger a Lua error message? What do you expect to happen? What exactly does happen?
Without knowing anything else, I think you may be confused about what SetParent does. It sets the frame's parent, yes, but that has nothing to do with a frame's position, so you shouldn't expect to see any immediate visual change when you reparent a frame. I'm guessing you're trying to do something like this: pet:SetPoint("BOTTOM", BT4PetButton1, "TOP", 0, 20) |
[quote]
Quote:
Quote:
when i set Quote:
|
Why aren't you just doing this?
Code:
local pet = CreateFrame("Frame", nil, BT4PetButton1) Also, Code:
pet:SetParent("BT4PetButton1") -- string Code:
pet:SetParent(BT4PetButton1) -- reference to frame /edit: in the future, use a [code] block instead of a [quote] block to preserve formatting. |
Even better, use the [highlight=lua] tag so it colors everything automatically.
lua Code:
Anyways, try setting your parent first, then the points. It's also a good practice to clear the points before reanchoring just to be safe (frame:ClearAllPoints()) |
Quote:
Quote:
|
well i got it to work for my pet bar... ended up switching addons to dominos.. and it worked fine.. but now i cant get it to parent to my class/stance bar...
here is the in-game name given for it... Quote:
here is the coding for my frame. Code:
local stance = CreateFrame("Frame", nil, DominosClassButton1) |
To test something, try putting this above the CreateFrame() call.
Code:
print(DominosClassButton1) If it says "nil", the pointer doesn't exist at that specific time. If it says "table: <some hex value>", that should be the frame you're trying to set your parent as. |
Quote:
|
Quote:
Quote:
lua Code:
i set my TOC file to have a dependency to Dominos for my addon... but it doesn't change it.. still acts as though the dependency isnt there... plus it worked fine for the PetActionButton... and i didnt have dominos as a dependancy then. |
Just because you have set a dependency does not mean that that dependency has created all it's frames when your addon is loaded.
Dominos may wait until certain events occur in game (e.g. PLAYER_ENTERING_WORLD) before it creates some of its frames. In fact, looking through the Dominos code I can see that the DominosClassButton1 you are trying to use as a parent is not created until the event UPDATE_SHAPESHIFT_FORMS is fired. You have to use some strategy to create your frames after Dominos haves created its frames. |
Quote:
By contrast, most addons try to avoid creating frames that may not be needed until they are actually needed. What you're seeing in Dominos is a good example of this -- rather than creating stance/form buttons as soon as it loads, the addon waits until those buttons are actually needed, and then creates them on demand. This way, if you're playing a mage, the addon isn't wasting resources by creating a bunch of frames you'll never see or use. |
All times are GMT -6. The time now is 10:26 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI