WoW:API Region SetPoint: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Added comment on units.)
(updated defaults of frame argument)
Line 8: Line 8:
  obj:SetPoint(point, x, y);
  obj:SetPoint(point, x, y);
  obj:SetPoint(point, frame, relativePoint , x, y);
  obj:SetPoint(point, frame, relativePoint , x, y);


----
----
Line 19: Line 17:
; frame  
; frame  
: the name of the frame to attach the obj to, an actual frame variable can also be used (can be "UIParent" to attach it to the screen itself)
: the name of the frame to attach the obj to, an actual frame variable can also be used (can be "UIParent" to attach it to the screen itself)
: defaults to the parent of obj when not specified
: defaults to the parent of obj when not specified, or the screen (not UIParent) when obj does not have a parent


; relativePoint  
; relativePoint  

Revision as of 21:36, 11 January 2006

SetPoint -Documentation by Sarf-

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);

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" to attach it to the screen itself)
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 the 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);
Result

Description
Attaches obj to the specified position.

Template:WoW API