WoW:API Region SetPoint: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
| Line 1: | Line 1: | ||
{{widgetmethod}} | |||
Sets the current attachment point of an UI component. Any of the following formats are valid | Sets the current attachment point of an UI component. Any of the following formats are valid | ||
| Line 9: | Line 9: | ||
obj:SetPoint(point, frame, relativePoint , x, y); | obj:SetPoint(point, frame, relativePoint , x, y); | ||
== Parameters == | |||
=== Arguments === | |||
; point | ; 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 | :; frame | ||
: | :: The name of the frame to attach the obj to - an actual frame variable can also be used (can be "UIParent"), or nil to anchor relative to the whole screen. | ||
: | :: Defaults to the parent of ''obj'' when not specified, or the screen (not UIParent) when obj does not have a parent | ||
; relativePoint | :; relativePoint | ||
: | :: The relative point to attach ''obj'' to (see [[API Positions]]) (i.e. bind your frame to the left side of the parent) | ||
: | :: Defaults to the value of ''point'' when not specified. | ||
; x | :; x | ||
: | :: The X offset (-5 means 5 units left, 5 means 5 units right) | ||
: | :: Defaults to 0 when not specified | ||
: | :: Units are relative to the screen with the frame's effective scale. | ||
; y | :; y | ||
: | :: The Y offset (-5 means 5 units down, 5 means 5 units up) | ||
: | :: Defaults to 0 when not specified | ||
: | :: Units are relative to the screen with the frame's effective scale. | ||
=== Returns === | |||
:;nil | :;nil | ||
== Examples == | |||
The following are all equivalent. | The following are all equivalent. | ||
MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); | MainMenuBar:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); | ||
| Line 50: | Line 47: | ||
MainMenuBar:SetPoint("BOTTOMLEFT", 0, 0); | MainMenuBar:SetPoint("BOTTOMLEFT", 0, 0); | ||
== Details == | |||
-- | * You will have to do a {{code|obj:[[API Region ClearAllPoints|ClearAllPoints]]()}} before using obj:SetPoint(...), if you expect the frame to actually move. -- [[User:Maisha|Maisha]] | ||
* 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 06:37, 19 August 2006
← Widget API ← Region < SetPoint
Sets the current attachment point of an UI component. Any of the following formats are valid
obj:SetPoint(point); obj:SetPoint(point, frame); obj:SetPoint(point, frame, relativePoint); obj:SetPoint(point, x, y); 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
- The name of the frame to attach the obj to - an actual frame variable can also be used (can be "UIParent"), or nil to anchor relative to the whole screen.
- Defaults to the parent of obj when not specified, or the screen (not UIParent) when obj does not have a parent
- relativePoint
- The relative point to attach obj to (see API Positions) (i.e. bind your frame to the left side of the parent)
- Defaults to the value of point when not specified.
- x
- The X offset (-5 means 5 units left, 5 means 5 units right)
- Defaults to 0 when not specified
- Units are relative to the screen with the frame's effective scale.
- y
- The Y offset (-5 means 5 units down, 5 means 5 units up)
- Defaults to 0 when not specified
- Units are relative to the screen with the frame's effective scale.
Returns
- nil
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 Template:Code before using obj:SetPoint(...), if you expect the frame to actually move. -- Maisha
- 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.