Note: Many of you probably know more about this than I do, but this was the hardest thing for me to figure out on my own. I didn't know what half of the positioning stuff did, but eventually I figured it out...I'd like to help anyone else whose having problems with the same kinda stuff. If there's anything wrong with this post factually, please let me know so I can fix it!
-----
Blizzard's UI uses relative frame positioning to determine where to draw frames on screen. At first, this confused me a great deal because I didn't understand what things like Point1 and Point2 meant, what the relative parent of a frame was, or how these things all worked together to make everything display on screen. Now that I've figured out how all this stuff works, recreating my UI has been a much easier process.
Each frame has 5 different values that determine where it actually shows up on the screen: pr, p1, p2, x, and y. Each of these values is equally important, especially if you want to position stuff precisely and correctly, and so now I'm going to tell you what each one of them does!
pr: This is the relative parent of the frame. The pr is the frame which your frame is anchored to. Your frame will move when it's pr moves. Your frame will hide when it's pr does. It's important. This frame is USUALLY set to the actual parent of the frame, but it does NOT have to be. Often the pr on a frame is UIParent, which is the screen.
p1, p2: Each of these can be one of the following values: TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, BOTTOMRIGHT. p1 is the point on the frame that is being modified, and p2 is the point on pr. These points form the center of your x-y offset grid, leading me to...
x, y: These are the offset values for the anchor point.
Now, putting it all together. Let's use the Minimap for an example. Say we want to move the Minimap (and all it's associated goodies) from the upper right hand corner of the screen to the top center of the screen. To do this we'd set the following...
* frame: MinimapCluster - this is the frame we want to move
* pr: UIParent - this is the frame we want to anchor to
* p1: TOP - this is the point on our frame that we want to attach to p2, in this case the top center of the frame
* p2: TOP - this is the point that we want to attach to on pr, again in this case the top center of the frame
* x: 0 - we don't want any x offset
* y: 0 - again, no offset.
One key thing to note here is that if you change pr, p1, or p2 and don't reset the x and y offsets, your frame will probably not move. This is because the UI recalculates these values if pr, p1, or p2 are changed so that the frame will not move and perhaps randomly dissappear (by being positioned offscreen).
So, I hope that helps anyone whose having big problems figuring out how to position frames (as I did).
One key thing to note here is that if you change pr, p1, or p2 and don't reset the x and y offsets, your frame will probably not move. This is because the UI recalculates these values if pr, p1, or p2 are changed so that the frame will not move and perhaps randomly dissappear (by being positioned offscreen).
I also found out that when changing the scale and parenting sometimes things will end up off the screen. I still don't fully understand it, but next time I will not let the PC use defaults I will add in all info and see if it makes a difference, thanks
Scale will affect the size of the frame as its supposed to. But you also must realize that it will also affect the offsets. This is why frames move when the scale changes.
Reparenting shouldn't move frames. Perhaps this is something specific to the way Visor handles frames and their parents. The only condition I can think of would be reparenting and then scaling the parent frame.
Also keep in mind that all dimensions are assuming 1024x768. So for the purposes of offsets your screen has a width of 1024 and a height of 768. This is not affected by your actual screen size. A frame will move the exact same distance if your screen is at 800x600 or 1600x1200. I am not sure how this works for widescreen resolutions though. I have only tested this with 4:3 resolutions.
-----
Blizzard's UI uses relative frame positioning to determine where to draw frames on screen. At first, this confused me a great deal because I didn't understand what things like Point1 and Point2 meant, what the relative parent of a frame was, or how these things all worked together to make everything display on screen. Now that I've figured out how all this stuff works, recreating my UI has been a much easier process.
Each frame has 5 different values that determine where it actually shows up on the screen: pr, p1, p2, x, and y. Each of these values is equally important, especially if you want to position stuff precisely and correctly, and so now I'm going to tell you what each one of them does!
pr: This is the relative parent of the frame. The pr is the frame which your frame is anchored to. Your frame will move when it's pr moves. Your frame will hide when it's pr does. It's important. This frame is USUALLY set to the actual parent of the frame, but it does NOT have to be. Often the pr on a frame is UIParent, which is the screen.
p1, p2: Each of these can be one of the following values: TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM, BOTTOMRIGHT. p1 is the point on the frame that is being modified, and p2 is the point on pr. These points form the center of your x-y offset grid, leading me to...
x, y: These are the offset values for the anchor point.
Now, putting it all together. Let's use the Minimap for an example. Say we want to move the Minimap (and all it's associated goodies) from the upper right hand corner of the screen to the top center of the screen. To do this we'd set the following...
* frame: MinimapCluster - this is the frame we want to move
* pr: UIParent - this is the frame we want to anchor to
* p1: TOP - this is the point on our frame that we want to attach to p2, in this case the top center of the frame
* p2: TOP - this is the point that we want to attach to on pr, again in this case the top center of the frame
* x: 0 - we don't want any x offset
* y: 0 - again, no offset.
One key thing to note here is that if you change pr, p1, or p2 and don't reset the x and y offsets, your frame will probably not move. This is because the UI recalculates these values if pr, p1, or p2 are changed so that the frame will not move and perhaps randomly dissappear (by being positioned offscreen).
So, I hope that helps anyone whose having big problems figuring out how to position frames (as I did).
I also found out that when changing the scale and parenting sometimes things will end up off the screen. I still don't fully understand it, but next time I will not let the PC use defaults I will add in all info and see if it makes a difference, thanks
Reparenting shouldn't move frames. Perhaps this is something specific to the way Visor handles frames and their parents. The only condition I can think of would be reparenting and then scaling the parent frame.
Also keep in mind that all dimensions are assuming 1024x768. So for the purposes of offsets your screen has a width of 1024 and a height of 768. This is not affected by your actual screen size. A frame will move the exact same distance if your screen is at 800x600 or 1600x1200. I am not sure how this works for widescreen resolutions though. I have only tested this with 4:3 resolutions.
Althaya
http://www.wowwiki.com/UI_Coordinates
http://www.wowwiki.com/How_UI_Is_Rendered