Sets an anchor point for the region

Signature:

Region:SetPoint("point" [, relativeTo [, "relativePoint" [, xOffset [, yOffset]]]])

Arguments:

  • point - Point on this region at which it is to be anchored to another (string, anchorPoint)
  • relativeTo - Reference to the other region to which this region is to be anchored; if omitted, anchors the region relative to its parent (or to the screen dimensions if the region has no parent). If passed explicitely nil, defaults to the entire screen. (region)
  • relativePoint - Point on the other region to which this region is to be anchored; if nil or omitted, defaults to the same value as point (string, anchorPoint)
  • xOffset - Horizontal distance between point and relativePoint (in pixels; positive values put point to the right of relativePoint); if nil or omitted, defaults to 0 (number)
  • yOffset - Vertical distance between point and relativePoint (in pixels; positive values put point below relativePoint); if nil or omitted, defaults to 0 (number)

Examples:

-- Create a sample frame and give it a visible background color
local frame = CreateFrame("Frame", "TestFrame", UIParent)
local background = frame:CreateTexture("TestFrameBackground", "BACKGROUND")
background:SetTexture(1, 1, 1, 0.25)
background:SetAllPoints()

-- Set the top left corner 5px to the right and 15px above UIParent's top left corner
frame:SetPoint("TOPLEFT", 5, 15)

-- Set the bottom edge to be 10px below WorldFrame's center
frame:SetPoint("BOTTOM", WorldFrame, "CENTER", 0, -10)

-- Set the right edge to be 20px to the left of WorldFrame's right edge
frame:SetPoint("RIGHT", WorldFrame, -20, 0)