MessageFrames are used to present series of messages or other lines of text, usually stacked on top of each other. Like most widgets relating to text display, MessageFrame inherits from FontInstance as well as Frame to provide methods for setting up text characteristics. Once the text settings for the frame are configured to your liking, you can add new messages to the frame with :AddMessage()
. MessageFrame also supports methods for multi-line text display such as indented lines, as well as options for controlling how long messages should be displayed and how quickly they fade out when their time is up.
The stock UI uses the basic message frame for only one purpose, but it gets a lot of use; UIErrorsFrame, which displays messages like "Spell not ready yet" or "You're too far away", is a MessageFrame. MessageFrame also forms the basis for another, more sophisticated type, ScrollingMessageFrame.
Defined Methods
- MessageFrame:AddMessage("text" [, red [, green [, blue [, alpha]]]]) - Adds a message to those listed in the frame
- MessageFrame:Clear() - Removes all messages displayed in the frame
- duration = MessageFrame:GetFadeDuration() - Returns the duration of the fade-out animation for disappearing messages
- fading = MessageFrame:GetFading() - Returns whether messages added to the frame automatically fade out after a period of time
- indent = MessageFrame:GetIndentedWordWrap() - Returns whether long lines of text are indented when wrapping
- position = MessageFrame:GetInsertMode() - Returns the position at which new messages are added to the frame
- time = MessageFrame:GetTimeVisible() - Returns the amount of time for which a message remains visible before beginning to fade out
- MessageFrame:SetFadeDuration(duration) - Sets the duration of the fade-out animation for disappearing messages
- MessageFrame:SetFading(fading) - Sets whether messages added to the frame automatically fade out after a period of time
- MessageFrame:SetIndentedWordWrap(indent) - Sets whether long lines of text are indented when wrapping
- MessageFrame:SetInsertMode("position") - Sets the position at which new messages are added to the frame
- MessageFrame:SetTimeVisible(time) - Sets the amount of time for which a message remains visible before beginning to fade out
Inherited Methods
- MessageFrame:GetPropagateKeyboardInput() - This function is not yet documented
- MessageFrame:IsForbidden() - This function is not yet documented
- MessageFrame:RegisterUnitEvent() - This function is not yet documented
- MessageFrame:SetDontSavePosition() - This function is not yet documented
- MessageFrame:SetPropagateKeyboardInput() - This function is not yet documented
- MessageFrame:SetShown() - This function is not yet documented
- MessageFrame:SetSize(width, height) - Sets the size of the region to the specified values
- MessageFrame:SetSpacing(spacing) - Sets the font instance's amount of spacing between lines
- MessageFrame:SetTextColor(textR, textG, textB, textAlpha) - Sets the font instance's default text color
- MessageFrame:SetToplevel(enable) - Sets whether the frame should automatically come to the front when clicked
- MessageFrame:SetUserPlaced(enable) - Flags the frame for automatic saving and restoration of position and dimensions
- MessageFrame:SetWidth(width) - Sets the region's width
- MessageFrame:Show() - Shows the region
- MessageFrame:StartMoving() - Begins repositioning the frame via mouse movement
- MessageFrame:StartSizing() - Begins resizing the frame via mouse movement
- MessageFrame:StopAnimating() - Stops any active animations involving the region or its children
- MessageFrame:StopMovingOrSizing() - Ends movement or resizing of the frame initiated with [[docs/widgets/Frame/StartMoving|`:StartMoving()`]] or [[docs/widgets/Frame/StartSizing|`:StartSizing()`]]
- MessageFrame:UnregisterAllEvents() - Unregisters the frame from any [[docs/events|events]] for which it is registered
- MessageFrame:UnregisterEvent("event") - Unregisters the frame for an event
Script Handlers
- OnAttributeChanged(self, "name", 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 [[docs/events|event]] fires for which the frame is registered
- OnHide(self) - Run when the frame's visbility changes to hidden
- 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
- OnLoad(self) - Run when the frame is created
- 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
- OnUpdate(self, elapsed) - Run each time the screen is drawn by the game engine