Thread Tools Display Modes
02-10-06, 05:22 PM   #1
saxon
A Defias Bandit
Join Date: Feb 2006
Posts: 2
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
  Reply With Quote
02-10-06, 08:09 PM   #2
Iriel
Super Moderator
WoWInterface Super Mod
Featured
Join Date: Jun 2005
Posts: 578
You need to ClearAllPoints, then SetPoint on one corner (or the center) if you want Width and Height to be respected, otherwise you can end up with other implicit points getting in the way.

(I'm pretty sure that works the way you want)
  Reply With Quote
02-11-06, 12:10 AM   #3
saxon
A Defias Bandit
Join Date: Feb 2006
Posts: 2
Thanks, that definitely did it, among other smaller problems I had.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Positioning frames in LUA


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off