WoW:API Region SetPoint: Difference between revisions
Jump to navigation
Jump to search
(→Details: removed stray pipe) |
|||
| Line 7: | Line 7: | ||
== Parameters == | == Parameters == | ||
=== Arguments === | === Arguments === | ||
; point : The point on your object to use for attaching the obj (see [[API Positions]]) (i.e. bind the left side of your frame) | |||
; frame : Name of, or reference to, a frame to attach obj to; or nil to anchor relative to obj's parent (if no parent exists, anchor reative to the whole screen). | |||
; relativePoint : The relative point of ''frame'' to attach ''obj'' to (see [[API Positions]]); if not specified, defaults to the value of ''point'' when not specified. | |||
; x : x-offset (negative values will move ''obj'' left, positive values will move ''obj'' right), defaults to 0 if not specified. | |||
; y : y-offset (negative values will move ''obj'' down, positive values will move ''obj'' up), defaults to 0 if not specified. | |||
: | |||
: | |||
: | |||
== Examples == | == Examples == | ||
| Line 46: | Line 27: | ||
* You will have to do a <code>obj:[[API Region ClearAllPoints|ClearAllPoints]]()</code> before using obj:SetPoint(...), if you expect the frame to actually move. -- [[User:Maisha|Maisha]] | * You will have to do a <code>obj:[[API Region ClearAllPoints|ClearAllPoints]]()</code> before using obj:SetPoint(...), if you expect the frame to actually move. -- [[User:Maisha|Maisha]] | ||
* x and y units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, width varies with aspect ratio. | |||
* As of 1.11 or so, there seems to be an [[API Region SetPoint/Exponential time|exponential-time increase]] if you anchor chains of objects with more than one point. | * As of 1.11 or so, there seems to be an [[API Region SetPoint/Exponential time|exponential-time increase]] if you anchor chains of objects with more than one point. | ||
Revision as of 20:07, 13 August 2007
← Widget API ← Region < SetPoint
Sets the current attachment point of an UI component.
obj:SetPoint(point [, frame] [, relativePoint] [, x [, y]]);
Parameters
Arguments
- point
- The point on your object to use for attaching the obj (see API Positions) (i.e. bind the left side of your frame)
- frame
- Name of, or reference to, a frame to attach obj to; or nil to anchor relative to obj's parent (if no parent exists, anchor reative to the whole screen).
- relativePoint
- The relative point of frame to attach obj to (see API Positions); if not specified, defaults to the value of point when not specified.
- x
- x-offset (negative values will move obj left, positive values will move obj right), defaults to 0 if not specified.
- y
- y-offset (negative values will move obj down, positive values will move obj up), defaults to 0 if not specified.
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
- You will have to do a
obj:ClearAllPoints()before using obj:SetPoint(...), if you expect the frame to actually move. -- Maisha
- x and y units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, width varies with aspect ratio.
- As of 1.11 or so, there seems to be an exponential-time increase if you anchor chains of objects with more than one point.