The most sophisticated control over text display is offered by SimpleHTML widgets. When its text is set to a string containing valid HTML markup, a SimpleHTML widget will parse the content into its various blocks and sections, and lay the text out. While it supports most common text commands, a SimpleHTML widget accepts an additional argument to most of these; if provided, the element argument will specify the HTML elements to which the new style information should apply, such as formattedText:SetTextColor("h2", 1, 0.3, 0.1)
which will cause all level 2 headers to display in red. If no element name is specified, the settings apply to the SimpleHTML widget's default font.
Like ScrollingMessageFrame, SimpleHTML also provides hyperlink support, including a hook to control the formatting of hyperlinked text with :SetHyperlinkFormat
. This function takes a string, which is provided to string.format along with strings representing the hyperlink's address and body text, and produces the appropriate link and color codes along with any other desired formatting.
This widget does not support scrolling by itself, but you can use it as a ScrollChild to support longer blocks of text. In addition, it is used by the stock UI to display the contents of the books that your character may find lying around inns and libraries.
Defined Methods
- SimpleHTML:GetContentHeight() - This function is not yet documented
- filename, fontHeight, flags = SimpleHTML:GetFont(["element"]) - Returns basic properties of a font used in the frame
- font = SimpleHTML:GetFontObject(["element"]) - Returns the `Font` object from which the properties of a font used in the frame are inherited
- format = SimpleHTML:GetHyperlinkFormat() - Returns the format string used for displaying hyperlinks in the frame
- enabled = SimpleHTML:GetHyperlinksEnabled() - Returns whether hyperlinks in the frame's text are interactive
- indent = SimpleHTML:GetIndentedWordWrap(["element"]) - Returns whether long lines of text are indented when wrapping
- justify = SimpleHTML:GetJustifyH(["element"]) - Returns the horizontal alignment style for text in the frame
- justify = SimpleHTML:GetJustifyV(["element"]) - Returns the vertical alignment style for text in the frame
- shadowR, shadowG, shadowB, shadowAlpha = SimpleHTML:GetShadowColor(["element"]) - Returns the shadow color for text in the frame
- xOffset, yOffset = SimpleHTML:GetShadowOffset(["element"]) - Returns the offset of text shadow from text in the frame
- spacing = SimpleHTML:GetSpacing(["element"]) - Returns the amount of spacing between lines of text in the frame
- textR, textG, textB, textAlpha = SimpleHTML:GetTextColor(["element"]) - Returns the color of text in the frame
- isValid = SimpleHTML:SetFont(["element",] "filename", fontHeight, "flags") - Sets basic properties of a font used in the frame
- SimpleHTML:SetFontObject(["element",] font) or SimpleHTML:SetFontObject(["element",] "name") - Sets the `Font` object from which the properties of a font used in the frame are inherited
- SimpleHTML:SetHyperlinkFormat("format") - Sets the format string used for displaying hyperlinks in the frame
- SimpleHTML:SetHyperlinksEnabled(enable) - Enables or disables hyperlink interactivity in the frame
- SimpleHTML:SetIndentedWordWrap(["element",] indent) - Sets whether long lines of text are indented when wrapping
- SimpleHTML:SetJustifyH(["element",] "justify") - Sets the horizontal alignment style for text in the frame
- SimpleHTML:SetJustifyV(["element",] "justify") - Sets the vertical alignment style for text in the frame
- SimpleHTML:SetShadowColor(["element",] shadowR, shadowG, shadowB, shadowAlpha) - Sets the shadow color for text in the frame
- SimpleHTML:SetShadowOffset(["element",] xOffset, yOffset) - Returns the offset of text shadow from text in the frame
- SimpleHTML:SetSpacing(["element",] spacing) - Sets the amount of spacing between lines of text in the frame
- SimpleHTML:SetText("text") - Sets the text to be displayed in the SimpleHTML frame
- SimpleHTML:SetTextColor(["element",] textR, textG, textB, textAlpha) - Sets the color of text in the frame
Inherited Methods
- SimpleHTML:GetPropagateKeyboardInput() - This function is not yet documented
- SimpleHTML:IsForbidden() - This function is not yet documented
- SimpleHTML:RegisterUnitEvent() - This function is not yet documented
- SimpleHTML:SetDontSavePosition() - This function is not yet documented
- SimpleHTML:SetPropagateKeyboardInput() - This function is not yet documented
- SimpleHTML:SetShown() - This function is not yet documented
- SimpleHTML:SetSize(width, height) - Sets the size of the region to the specified values
- SimpleHTML:SetToplevel(enable) - Sets whether the frame should automatically come to the front when clicked
- SimpleHTML:SetUserPlaced(enable) - Flags the frame for automatic saving and restoration of position and dimensions
- SimpleHTML:SetWidth(width) - Sets the region's width
- SimpleHTML:Show() - Shows the region
- SimpleHTML:StartMoving() - Begins repositioning the frame via mouse movement
- SimpleHTML:StartSizing() - Begins resizing the frame via mouse movement
- SimpleHTML:StopAnimating() - Stops any active animations involving the region or its children
- SimpleHTML:StopMovingOrSizing() - Ends movement or resizing of the frame initiated with [[docs/widgets/Frame/StartMoving|`:StartMoving()`]] or [[docs/widgets/Frame/StartSizing|`:StartSizing()`]]
- SimpleHTML:UnregisterAllEvents() - Unregisters the frame from any [[docs/events|events]] for which it is registered
- SimpleHTML: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
- OnHyperlinkClick(self, "linkData", "link", "button") - Run when the mouse clicks a hyperlink in the scrolling message frame or SimpleHTML frame
- OnHyperlinkEnter(self, "linkData", "link") - Run when the mouse moves over a hyperlink in the scrolling message frame or SimpleHTML frame
- OnHyperlinkLeave(self, "linkData", "link") - Run when the mouse moves away from a hyperlink in the scrolling message frame or SimpleHTML frame
- 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