Wowpedia
Advertisement
Wowpedia
240,442
pages

Controls how much of the frame may be moved off-screen.

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

Arguments

left 
number - Left clamp region offset. Controls collision with the left edge of the screen, positive values allow the frame to be moved off-screen, negative values enforce minimum distance to the edge.
right 
number - Right clamp region offset. Controls collision with the right edge of the screen, negative values allow the frame to be moved off-screen, positive values enforce minimum distance to the edge.
top 
number - Top clamp region offset. Controls collision with the top edge of the screen, negative values allow the frame to be moved off-screen, positive values enforce minimum distance to the edge.
bottom 
number - Bottom clamp region offset. Controls collision with the bottom edge of the screen, positive values allow the frame to be moved off-screen, negative values enforce minimum distance to the edge.

Details

Example

The following code creates a draggable frame that can be moved 42 size units off any edge of the screen, but can never entirely off-screen.

local frame = CreateFrame("FRAME", nil, UIParent)
frame:SetSize(200, 100)
frame:SetPoint("CENTER")
frame:SetMovable(true)
frame:SetScript("OnMouseDown", frame.StartMoving)
frame:SetScript("OnMouseUp", frame.StopMovingOrSizing)
frame:SetClampedToScreen(true)
frame:SetClampRectInsets(42, -42, -42, 42)
local tex = frame:CreateTexture()
tex:SetTexture(1,0,0)
tex:SetAllPoints()

See also

Advertisement