Sets offsets from the frame's edges used when limiting user movement or resizing of the frame. Note: despite the name of this method, the parameters are offsets along the normal axes -- to inset the frame's clamping area from its edges, the left and bottom measurements should be positive and the right and top measurements should be negative.

Signature:

Frame:SetClampRectInsets(left, right, top, bottom)

Arguments:

  • left - Offset from the left edge of the frame to the left edge of its clamping area (in pixels) (number)
  • right - Offset from the right edge of the frame's clamping area to the right edge of the frame (in pixels) (number)
  • top - Offset from the top edge of the frame's clamping area to the top edge of the frame (in pixels) (number)
  • bottom - Offset from the bottom edge of the frame to the bottom edge of its clamping area (in pixels) (number)

Examples:

-- creates a drag-movable frame which cannot be moved beyond the edges of the screen
CreateFrame("Frame","Test",UIParent)
Test:SetWidth(100)
Test:SetHeight(100)
Test:SetPoint("CENTER")
Test:EnableMouse(true)
Test:SetClampedToScreen(true)
Test:CreateTexture("TestBG")
TestBG:SetAllPoints()
TestBG:SetTexture(1,1,1,0.5)
Title=Test:CreateTitleRegion()
Title:SetAllPoints()

-- inset the clamping area, allowing the frame to be moved partially offscreen by 50 pixels in any direction
Test:SetClampRectInsets(50,-50,-50,50)
-- outset the clamping area, allowing the frame to be moved no closer than 50 pixels to any edge of the screen
Test:SetClampRectInsets(-50,50,50,-50)