WoW:API Region SetPoint: Difference between revisions

updated argument list and listed defaults for arguments that are not specified
No edit summary
(updated argument list and listed defaults for arguments that are not specified)
Line 1: Line 1:
  <center>'''SetPoint''' ''-Documentation by [[Sarf]]-''</center>
  <center>'''SetPoint''' ''-Documentation by [[Sarf]]-''</center>


Sets the current attachment point of an UI component.
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);
 


obj:SetPoint(point, parent, relativePoint[, x, y]);


----
----
;''Arguments''
;''Arguments''


; point : the point to attach the obj to (see [[API Positions]])  (i.e.  bind the left side of your frame)
; point  
; parent : the name of the parent to attach the obj to (can be "UIParent" to attach it to the screen itself)
: the point to attach the obj to (see [[API Positions]])  (i.e.  bind the left side of your frame)
; relativePoint : the relative point to attach the obj to (see [[API Positions]])  (i.e. bind your frame to the left side of the parent)
 
; x : the X offset (-5 means 5 units left, 5 means 5 units right)
; frame
; y : the Y offset (-5 means 5 units down, 5 means 5 units up)
: 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
 
; 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
 
; y  
: the Y offset (-5 means 5 units down, 5 means 5 units up)
: defaults to 0 when not specified


----
----
Line 20: Line 39:


----
----
;''Example''
;''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", 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''
;''Result''
Anonymous user