Frame (inherits from Region and ScriptObject, created with CreateFrame) provides the basis for interaction with the user, and registering and responding to game events.

Other types of widget derivatives such as FontStrings, Textures and Animations can only be created attached to a Frame or other derivative of a Frame.

When an addon needs to respond to game events or state changes and needs no visible components, this is typically accomplished using a Frame. Visibly, widgets that display game information such as threat or cooldowns and aren't directly interactive beyond being draggable are typically Frames. They are also commonly used as ways to group other related frames, either visibly (such as the way the Talents pane groups the buttons representing your character's talents) or invisibly (such as the way MultiBarRight groups twelve action buttons).

Defined Methods

Frame:RegisterEvent(event) - Register for notifications when an event occurs.
Frame:RegisterUnitEvent(event, unit1 [, unit2]) - Register for notifications when events apply to certain units.
Frame:RegisterAllEvents() - Register this frame to receive all events (For debugging only!)
Frame:UnregisterEvent(event) - Indicate that this frame should no longer be notified when event occurs.
Frame:UnregisterAllEvents() - Indicate that this frame should no longer be notified when any events occur.
Frame:IsEventRegistered(event) - Returns true if the given event is registered to the frame.
Position & Visibility
Frame:DisableDrawLayer(layer) - Disables the specified draw layer.
Frame:EnableDrawLayer(layer) - Enables the specified draw layer.
Frame:GetClampRectInsets() - Gets the modifiers used for limiting the frame from leaving the screen.
Frame:GetDepth() - Returns the stereoscopic (3D) depth, relative to its parent if applicable.
Frame:GetEffectiveAlpha() - Returns the effective alpha of a frame.
Frame:GetEffectiveDepth() - Returns the absolute stereoscopic (3D) depth.
Frame:GetFrameLevel() - Returns the level of this frame.
Frame:GetFrameStrata() - Returns the strata of this frame.
Frame:GetHitRectInsets(l, r, t, b) - Gets the frame's hit rectangle inset distances
Frame:GetMaxResize(w, h) - Returns the frame's maximum allowed resize bounds
Frame:GetMinResize(w, h) - Returns the frame's minimum allowed resize bounds
Frame:HasFixedFrameLevel() : boolean
Frame:HasFixedFrameStrata() : boolean
Frame:IsClampedToScreen() - Returns if the frame is prohibited from being dragged off screen.
Frame:IsToplevel() - Returns if the frame is set as top level.
Frame:Lower() - Lowers this frame behind other frames.
Frame:Raise() - Raises this frame above other frames.
Frame:RotateTextures(angleRadians [, pivotX, pivotY])
Frame:SetClampedToScreen(clamped) - Sets whether the frame is prohibited from being dragged off screen.
Frame:SetClampRectInsets(left, right, top, bottom) - Modify how much the frame may be dragged offscreen.
Frame:SetDepth(depth) - Set the steroscopic (3D) depth, relative to its parent if applicable.
Frame:SetDrawLayerEnabled(layer, mouseOver)
Frame:SetFrameBuffer(enabled) - Controls whether or not the frame is rendered to its own framebuffer.
Frame:SetFrameLevel(level) - Positions the frame within a subdivision of its z-axis interval
Frame:SetFrameStrata(strata) - Positions the frame within a z-axis interval.
Frame:SetHitRectInsets(left, right, top, bottom) - Set the inset distances for the frame's hit rectangle.
Frame:SetMaxResize(maxWidth, maxHeight) - Sets the maximum dimensions this frame can be resized to.
Frame:SetMinResize(minWidth, minHeight) - Sets the minimum dimensions this frame can be resized to.
Frame:SetToplevel(isTopLevel) - Sets whether the frame should raise itself when clicked
Frame:GetChildren() - Returns child Frames as multiple return values.
Frame:GetNumChildren() - Returns the number of child Frames.
Frame:SetClipsChildren(clipped) - Sets the frame clipping its children.
Frame:GetNumRegions() - Returns the number of regions.
Frame:GetRegions() - Returns the regions.
Frame:CreateFontString() - Creates a FontString
Frame:CreateLine{) - Creates a Line
Frame:CreateMaskTexture() - Creates a MaskTexture
Frame:CreateTexture() - Creates a Texture
User Input
Frame:EnableKeyboard(enableFlag) - Whether to receive keyboard input.
Frame:EnableMouse(enableFlag) - Whether to receives mouse input.
Frame:EnableMouseWheel(enableFlag) - Whether to receive mouse wheel notifications.
Frame:GetPropagateKeyboardInput() - Returns if keyboard inputs propagate.
Frame:IsKeyboardEnabled() - Returns if receiving keyboard input.
Frame:IsMouseClickEnabled() - Returns if receiving mouse click inputs.
Frame:IsMouseEnabled() - Returns if receiving mouse input.
Frame:IsMouseMotionEnabled() - Returns if receiving mouse enter/hover notifications.
Frame:IsMouseWheelEnabled() - Returns if receiving mouse wheel notifications.
Frame:IsMovable() - Returns if the frame can be moved.
Frame:IsResizable() - Returns if the frame can be resized.
Frame:IsUserPlaced() - Returns if this frame has been relocated by the user.
Frame:RegisterForDrag(buttonType[,buttonType...]) - Direct the frame to monitor for mouse-dragging.
Frame:SetMovable(isMovable) - Whether the frame should be moved.
Frame:SetPropagateKeyboardInput(propagate) - Whether to propagate keyboard input to other frames.
Frame:SetResizable(isResizable) - Whether the frame should be resized.
Frame:SetUserPlaced(isUserPlaced) - Whether the frame is user-defined in the layout cache.
Frame:StartMoving() - Starts moving this frame.
Frame:StartSizing(point) - Starts sizing this frame using the specified anchor point.
Frame:StopMovingOrSizing() - Stops moving and/or sizing this frame.
Frame:GetAttribute(prefix, name, suffix) - Returns the current value of an attribute matching a given pattern.
Frame:SetAttribute(name, value) - Sets an attribute on the frame.
Frame:SetAttributeNoHandler(name, value) - Sets an attribute on the frame without triggering the OnAttributeChanged script handler.
Frame:ExecuteAttribute(name [, ...])
Frame:GetID() - Returns the frame ID.
Frame:SetID(id) - Sets an ID on this frame.

The Backdrop API was moved to BackdropTemplate in Patch 9.0.1

Frame:GetBackdrop() - Creates and returns a backdrop table suitable for use in SetBackdrop
Frame:GetBackdropBorderColor(r, g, b, a) - Gets the frame's backdrop border color
Frame:GetBackdropColor(r, g, b, a) - Gets the frame's backdrop color
Frame:SetBackdrop([backdropTable]) - Set the backdrop of the frame according to the specification provided.
Frame:SetBackdropBorderColor(r, g, b [, a]) - Set the frame's backdrop's border's color.
Frame:SetBackdropColor(r, g, b [, a]) - Set the frame's backdrop color.

Defined Script Handlers

OnAttributeChanged(self, key, value) - Run when a frame attribute is changed.
OnChar(self, text) - Run for each text character typed in the frame.
OnDisable(self) - Run when the frame is disabled.
OnDragStart(self, button) - Run when the mouse is dragged starting in the frame.
OnDragStop(self) - Run when the mouse button is released after a drag started in the frame,
OnEnable(self) - Run when the frame is enabled.
OnEnter(self, motion) - Run when the mouse cursor enters the frame's interactive area.
OnEvent(self, event, ...) - Run whenever an event fires for which the frame is registered.
OnHide(self) - Run when the frame's visbility changes to hidden.
OnHyperlinkClick(self, link, text, button) - Run when the mouse clicks a hyperlink on the FontInstance object.
OnHyperlinkEnter(self, link, text) - Run when the mouse moves over a hyperlink on the FontInstance object.
OnHyperlinkLeave(self, link, text) - Run when the mouse moves away from a hyperlink on the FontInstance object.
OnKeyDown(self, key) - Run when a keyboard key is pressed if the frame is keyboard enabled.
OnKeyUp(self, key) - Run when a keyboard key is released if the frame is keyboard enabled.
OnLeave(self, motion) - Run when the mouse cursor leaves the frame's interactive area.
OnMouseDown(self, button) - Run when a mouse button is pressed while the cursor is over the frame.
OnMouseUp(self, button) - Run when the mouse button is released following a mouse down action in the frame.
OnMouseWheel(self, delta) - Run when the frame receives a mouse wheel scrolling action.
OnReceiveDrag(self) - Run when the mouse button is released after dragging into the frame.
OnShow(self) - Run when the frame becomes visible.
OnSizeChanged(self, width, height) - Run when a frame's size changes.


Creates a simple frame with widget scripts (OnEnter and OnLeave) to respond when mousing over a Texture in the middle of the screen.

local frame = CreateFrame("Frame", nil, UIParent)

-- widget scripts
frame:SetScript("OnEnter", function()
	GameTooltip:SetOwner(frame, "ANCHOR_TOPRIGHT")
frame:SetScript("OnLeave", function()

-- adding a texture
local texture = frame:CreateTexture(nil, "BACKGROUND")

Or with a <Frame> element in an XML file.

		<AbsDimension x="100" y="100" />
		<Anchor point="CENTER" />
			GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
		<Layer level="BACKGROUND">
			<Texture file="interface\icons\inv_mushroom_11">
					<Anchor point="TOPLEFT" />
					<Anchor point="BOTTOMRIGHT" />

Patch changes

See also

External links


  1. ^ 2020-05-20, Backdrop.xml, version, archived at Townlong-Yak
  2. ^ Blizzard Entertainment Slouken 2006-05-12. Re: Upcoming 1.11 Changes - Concise List. Archived from the original
  3. ^ Iriel 2005-12-28. Upcoming 1.10 Changes - Concise List. Archived from the original
  4. ^ 2014-12-06, UI.xsd, version, near line 307, archived at Townlong-Yak