Positioning frames in LUA
Paraphrase: what I want to do is use Frame:SetPoint() entirely and never set the anchor and position in the XML. And I want SetHeight() to continue to work, which right now it breaks as soon as I do a SetPoint() on the frame.
I'm writing party frames who's HP and mana bars are 100% graphical, so right now I've got them as textures. When I define the anchor and position in the XML setting the height and texture coordinates it works flawlessly and the result is predictable (in my case I chop the top off the graphic so it shrinks without just scaling down the image). If I change the anchor from bottom to top in the XML then the SetHeight() method will trim from the bottom instead, which is exactly what I want.
But then I wanted each party member to inherit from a template and that's where my problems begin. In the template definition of course I don't know if the frame is going to be right-side-up or upside-down, so I removed all anchors from the frame (I initially left the anchors there and tried overriding them later in the OnLoad()).
No mater what I change the anchor point to use SetPoint() it pretty much makes SetHeight() stop working. In my case the textures are always 50 pixels (before scaling) high. In addition to this I have to SetPoint() both the top and bottom anchors or the height just is never correct (it looks roughly 256 pixels before scaling though I've not verified it). I even went and stopped using SetHeight() and instead SetPoint() both the top and bottom to get an effective height and they don't move.
I'm beginning to think that once you anchor a window that anchor is never removed and never overridden. Is this true? Is there a way to flush all anchors? I assume flushing the anchors is the solution but I cannot figure out if it's even possible.
Has anyone else run into this? Am I doomed to just have a template for the top and another for the bottom or perhaps just go back to not using templates at all?
Thanks for any help you can provide.
-saxon
|