wowpedia
Main Menu


Sets an anchor point for the region.

ScriptRegionResizing:SetPoint(point [, relativeTo [, relativePoint]] [, offsetX, offsetY])

Arguments

Frame points

Frame points

point
string : FramePoint - The point of this region.
TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT
TOP, BOTTOM, LEFT, RIGHT, CENTER
relativeTo
Object|string? - The reference or name of the other region. For example UIParent or "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). Requires offsetY to be specified.
offsetY
number? = 0 - Offset up (negative for down). Requires offsetX to be specified.

Example

Repositions the PlayerFrame.

Note
Note: This is not a permanent solution, especially with Edit Mode involved.
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

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

Battle for Azeroth Patch 8.2.0 (2019-06-25): Frames anchored to restricted frames can only be anchored within the same anchor family.[2]

See also