WoW:API Region SetPoint: Difference between revisions
Jump to navigation
Jump to search
m (→Arguments) |
m (lead in, signature whitespace) |
||
Line 1: | Line 1: | ||
{{widgetmethod}} | {{widgetmethod}} | ||
Sets an attachment point of an UI component. | |||
obj:SetPoint(point, relativeFrame, relativePoint, ofsx, ofsy); | |||
obj:SetPoint(point, relativeFrame, relativePoint); | |||
obj:SetPoint(point, ofsx, ofsy); | |||
obj:SetPoint(point); | |||
== Arguments == | |||
; point : String - Point of the object to adjust based on the anchor. | |||
; relativeFrame : String/Widget - Name of, or reference to, a frame to attach obj to; defaults to the object's parent (or the screen, if object has no parent) if nil or omitted. | |||
; relativePoint : String - point of the relativeFrame to attach point of obj to. If not specified, defaults to the value of point. | |||
; ofsx : Number - x-offset (negative values will move ''obj'' left, positive values will move ''obj'' right), defaults to 0 if not specified. | |||
; point : | ; ofsy : Number - y-offset (negative values will move ''obj'' down, positive values will move ''obj'' up), defaults to 0 if not specified. | ||
; | |||
; relativePoint : | |||
; | |||
; | |||
=== Points === | |||
There are eight valid point values: | |||
* "TOP", "RIGHT" "BOTTOM" "LEFT": the center-points of the respective sides. | |||
* "TOPRIGHT", "TOPLEFT", "BOTTOMLEFT", "BOTTOMRIGHT": corners of the frame rectangle. | |||
== Examples == | == Examples == | ||
Line 25: | Line 30: | ||
== Details == | == Details == | ||
* Behavior of this function with multiple anchors is complex. Generally, you can override points by setting them again (so repeated assignment to the "TOPLEFT" point of a frame would move the frame, unless other anchor points interfere). If you're repositioning a frame, call <code>obj:[[API Region ClearAllPoints|ClearAllPoints]]()</code> to eliminate unwanted interactions. | |||
* | * Offset units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, while screen width varies with aspect ratio. | ||
* | |||
Revision as of 01:07, 5 June 2009
← Widget API ← Region < SetPoint
Sets an attachment point of an UI component.
obj:SetPoint(point, relativeFrame, relativePoint, ofsx, ofsy); obj:SetPoint(point, relativeFrame, relativePoint); obj:SetPoint(point, ofsx, ofsy); obj:SetPoint(point);
Arguments
- point
- String - Point of the object to adjust based on the anchor.
- relativeFrame
- String/Widget - Name of, or reference to, a frame to attach obj to; defaults to the object's parent (or the screen, if object has no parent) if nil or omitted.
- relativePoint
- String - point of the relativeFrame to attach point of obj to. If not specified, defaults to the value of point.
- ofsx
- Number - x-offset (negative values will move obj left, positive values will move obj right), defaults to 0 if not specified.
- ofsy
- Number - y-offset (negative values will move obj down, positive values will move obj up), defaults to 0 if not specified.
Points
There are eight valid point values:
- "TOP", "RIGHT" "BOTTOM" "LEFT": the center-points of the respective sides.
- "TOPRIGHT", "TOPLEFT", "BOTTOMLEFT", "BOTTOMRIGHT": corners of the frame rectangle.
Examples
The following are all equivalent.
MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); MainMenuBar:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0); MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT"); MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent");
The following is equivalent to the above, given that the parent frame of MainMenuBar is UIParent.
MainMenuBar:SetPoint("BOTTOMLEFT"); MainMenuBar:SetPoint("BOTTOMLEFT", 0, 0);
Details
- Behavior of this function with multiple anchors is complex. Generally, you can override points by setting them again (so repeated assignment to the "TOPLEFT" point of a frame would move the frame, unless other anchor points interfere). If you're repositioning a frame, call
obj:ClearAllPoints()
to eliminate unwanted interactions. - Offset units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, while screen width varies with aspect ratio.