![]() |
The API is no longer being updated here until further notice. |
| This function is restricted.
|
Sets an anchor point for the region.
ScriptRegionResizing:SetPoint(point [, relativeTo [, relativePoint]] [, offsetX, offsetY])
Arguments
Frame points
- point
- string : FramePoint - The point of this region.
TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHTTOP, BOTTOM, LEFT, RIGHT, CENTER
- relativeTo
- Object|string? - The reference or name of the other region. For example
UIParentor"UIParent".- If omitted, anchors to the parent region if applicable, otherwise to the screen dimensions. Exceptions to this rule are frames managed by Edit Mode.[1]
- If explicitly passed
nil, anchors relative to the screen dimensions.
- relativePoint
- string? : FramePoint - The point of the other region to anchor to. If omitted, defaults to
point. - offsetX
- number?
= 0- Offset right (negative for left). RequiresoffsetYto be specified. - offsetY
- number?
= 0- Offset up (negative for down). RequiresoffsetXto be specified.
Example
Repositions the PlayerFrame.
PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("CENTER", UIParent)
Sets the same point multiple times, all of the calls have the same result and illustrate the different overloads:
local f = CreateFrame("Frame", nil, UIParent) -- UIParent is the parent
f:SetPoint("BOTTOMLEFT")
f:SetPoint("BOTTOMLEFT", 0, 0)
f:SetPoint("BOTTOMLEFT", UIParent)
f:SetPoint("BOTTOMLEFT", UIParent, 0, 0)
f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT")
f:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT")
f:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0)
Details
- UI scaling affects the distances for offsetX and offsetY; increasing the Region's scale will increase the offset.
- Protected frames may silently ignore calls to this function if the relative frame is a FontString.
Anchor family
There appear to be multiple causes that can throw anchor family connection errors.
-- anchors between UIParent and the screen dimensions
local f = CreateFrame("Frame")
f:SetPoint("TOPLEFT", UIParent)
f:SetPoint("BOTTOMRIGHT") -- Error: Action[SetPoint] failed because[SetPoint would result in anchor family connection]: attempted from: Frame:SetPoint.
-- connecting nameplates is expressly not allowed
local f = CreateFrame("Frame")
f:SetPoint("LEFT", NamePlate1)
f:SetPoint("RIGHT", NamePlate2) -- Error
Patch changes
Patch 8.2.0 (2019-06-25): Frames anchored to restricted frames can only be anchored within the same anchor family.[2]
