Can you name a frame AFTER it's been created?
I'm basically looking for a counterpart to frame:GetName()
I tried the following, which does not work: Lua Code:
In cas you're wondering, I want to reuse a frame I use to listen to PLAYER_LOGIN as one of the configuration-dependent frames to create afterwards. |
No, you can't, there is no SetName method. But normally there is no need to give a frame name unless it's a secure one.
If you need access it in _G, just use _G[name] = frame, it's not a good practice, since you always can save it in your own addon. Or you can create a parent-child system that the child's name is saved in its parent so you can access any frames in a root frame like `root.Form.Label:SetText(xx)`, it's the name of your own system, so you can change them to whatever you want. |
Thank you for the awesome tips, kurapica.igas!
_G[name] = frame seems to be more what I wanted. But the parent-child system looks interesting. I'll play around with those. |
The _G[] isn't required unless you're looking up the frame name as a string.
Code:
local f = Createframe("Frame", "FizzleFrameX", UIParent) |
Quote:
I'm not sure I understand what you said. I mean, in the example you gave, you could equally do: Lua Code:
|
All times are GMT -6. The time now is 08:54 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI