Posted by malsomnus on Sat, 05 Jan 2013 23:16:55
So I'm making an addon that tracks some of my auras, and allows me to move these little frames around. I used Frame:SetUserPlaced (true) to make the game remember where I placed the frames, and it works great... except for a specific one. Which is moved away to hide under my action bars every time I reload. I tried changing random things, and it appears that this happens as long as the frame shows the icon of the Vengeance buff. If I change nothing but the icon, it works properly. Similarly if I use the same icon for another ability, that one moves to a random spot as well. What in Elune's name is going on here??? :o
Posted by jnwhiteh on Sun, 06 Jan 2013 08:17:28
How is the frame named? In short, I have no idea.
Posted by malsomnus on Mon, 07 Jan 2013 06:04:52
The frame's name, because I assumed something unique is required, is frm.UnitName.RealmName.SpellID. I solved the problem on my DK by using another spell ID with the same icon... then had to find yet another spell ID for my druid due to the same problem. This must be the weirdest software bug I have ever seen :s
Posted by jnwhiteh on Mon, 07 Jan 2013 06:12:01
That's not the frame name, they cannot contain '.'. What is 'frm'.
Posted by malsomnus on Mon, 07 Jan 2013 18:55:00
Are you sure they can't contain periods? Because most of them seem to remember their positions just fine, and I thought you can't use that on forms without proper names.
Posted by jnwhiteh on Mon, 07 Jan 2013 18:59:26
As far as I know you can't do that with SetUserPlaced().. I know of no logic that would serialize frame elements to get the name. Or are those not element?
I'm not sure what you're doing or what's going on, any more information you can provide, code in particular, would be useful.
Posted by malsomnus on Tue, 08 Jan 2013 11:16:12
local frm = CreateFrame ("Frame", "frm"..UnitName('player')..GetRealmName()..spellID, UIparent)
As far as I can tell, it works now that I removed the periods from the name, and there is a possibility that the reason it was failing was related to the fact that Vengeance was used on several different characters. I do have concerns about the name being illegal on realms whose names contain illegal characters... in what scope do these names have to be unique? (I can only assume that they need to be unique in some scope)
Posted by jnwhiteh on Tue, 08 Jan 2013 20:47:41
Personally, I would recommend against using SetUserPlaced(), since it doesn't work well. For example, if the user disables the addon, logs in, then re-enables it, then reloads, the frame will reset position. Use LibWindow, IMO and profiles, rather than naming the frame based on the user/realm.
Or you could just do it without the library and just remove the periods.
Posted by jnwhiteh on Tue, 08 Jan 2013 20:48:37
The more direct answer to your question is:
- Don't name the frames (unless they have sub-names that use $parent)
- Assign them using _G['whatever' .. 'name' .. 'you' .. 'want'] = frame
Then it may work. Just one way to look at it.