Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Buttons respond to clicks and provide a label to inform the user what to anticipate. A button might appear different whether it is pushed, normal (depressed), or highlighted (hovered).


Class Hierarchy

Button extends Frame and also implements some traits of FontString by passing arguments to its label.

Constructor

Use the CreateFrame method with "Button" as the first argument (or one of its subtypes)

CreateFrame("Button")

API

Button has all the methods from Frame, plus the following:

Interaction
Button:Click() - Execute the click action of the button.
Button:Disable() - Disable the Button so that it cannot be clicked.
Button:Enable() - Enable to the Button so that it may be clicked.
Button:GetButtonState() - Return the current state ("PUSHED","NORMAL") of the Button.
Button:GetMotionScriptsWhileDisabled() - Get whether the button is allowed to run its OnEnter and OnLeave scripts even while disabled - New in 3.3.
Button:GetNormalTexture() - Get the normal texture for this button - New in 1.11.
Button:GetPushedTexture() - Get the texture for this button when pushed - New in 1.11.
Button:IsEnabled() - Determine whether the Button is enabled.
Button:RegisterForClicks("clickType"[,"clickType"...]) - Specify which mouse button up/down actions cause this button to receive an OnClick notification.
Button:RegisterForMouse()
Button:SetButtonState("state"[, lock]) - Set the state of the Button ("PUSHED", "NORMAL") and whether it is locked.
Button:SetEnabled(boolean) - Same as Enable() or Disable()
Button:SetMotionScriptsWhileDisabled([bool]) - Set whether button should fire its OnEnter and OnLeave scripts even while disabled - New in 3.3.
Appearance
Button:GetDisabledTexture() - Get the texture for this button when disabled - New in 1.11.
Button:GetHighlightTexture() - Get the texture for this button when highlighted.
Button:LockHighlight() - Set the Button to always be drawn highlighted.
Button:SetDisabledAtlas("atlasName")
Button:SetDisabledTexture(texture or "texturePath") - Set the disabled texture for the Button - Updated in 1.10.
Button:SetHighlightAtlas("atlasName"[, "blendmode")
Button:SetHighlightTexture(texture or "texturePath"[,alphaMode]) - Set the highlight texture for the Button.
Button:SetNormalAtlas("atlasName")
Button:SetNormalTexture(texture or "texturePath") - Set the normal texture for the Button - Updated in 1.10.
Button:UnlockHighlight() - Set the Button to not always be drawn highlighted.
Button:SetPushedAtlas("atlasName")
Button:SetPushedTexture(texture or "texturePath") - Set the pushed texture for the Button - Updated in 1.10.
Label
Button:GetDisabledFontObject() - Return the font object for the Button when disabled - New in 1.10.
Button:GetFontString() - Get this button's label FontString - New in 1.11.
Button:GetHighlightFontObject() - Return the font object for the Button when highlighted - New in 1.10.
Button:GetNormalFontObject() - Get the Font Object of the button.
Button:GetPushedTextOffset() - Get the text offset when this button is pushed (x, y) - New in 1.11.
Button:GetText() - Get the text label for the Button.
Button:GetTextHeight() - Get the height of the Button's text.
Button:GetTextWidth() - Get the width of the Button's text.
Button:SetDisabledFontObject([font]) - Set the font object for settings when disabled - New in 1.10.
Button:SetFontString(fontString) - Set the button's label FontString - New in 1.11.
Button:SetFormattedText("formatstring"[, ...]) - Set the formatted text label for the Button. - New in 2.3.
Button:SetHighlightFontObject([font]) - Set the font object for settings when highlighted - New in 1.10.
Button:SetNormalFontObject(FontObject) - Set the Font Object of the button.
Button:SetPushedTextOffset(x, y) - Set the text offset for this button when pushed - New in 1.11.
Button:SetText("text") - Set the text label for the Button.

See also

SecureActionButtonTemplate - A specific type of button that allows certain protected functionality during combat

Advertisement