Widget script handlers

Widget scripts allow you to respond to user interaction and other types of widget events (such as a frame being shown or hidden). This page lists the available scripts and the list of widget types for which each script is valid. Script types are defined in the XML Schema Definition.

Widget API

 * - Returns the widget's script handler.
 * - Sets the widget's script handler.
 * - Securely hooks a script handler.
 * - Returns whether the widget supports a script type.

Example
Registers for clicks on a widget with the  script.

AnimationGroup
AnimationGroup has the handlers from ScriptObject, plus the following:
 * OnFinished(self, requested) - Run when the animation (or animation group) finishes animating.
 * OnLoop(self, loopState) - Run when the animation group's loop state changes.
 * OnPause(self) - Run when the animation (or animation group) is paused.
 * OnPlay(self) - Run when the animation (or animation group) begins to play.
 * OnStop(self, requested) - Run when the animation (or animation group) is stopped.

Animation
Animation has the handlers from ScriptObject, plus the following:
 * OnFinished(self, requested)
 * OnPause(self)
 * OnPlay(self)
 * OnStop(self, requested)

Browser

 * OnButtonUpdate(self, action)
 * OnEditFocusGained(self)
 * OnEditFocusLost(self)
 * OnError(self, msg)
 * OnEscapePressed(self)
 * OnExternalLink(self, url)

Checkout

 * OnButtonUpdate(self, action)
 * OnEditFocusGained(self)
 * OnEditFocusLost(self)
 * OnError(self, msg)
 * OnEscapePressed(self)
 * OnExternalLink(self, url)
 * OnRequestNewSize(self, width, height)

ColorSelect

 * OnColorSelect(self, r, g, b) - Run when the color select frame's color selection changes.

FogOfWarFrame

 * OnUiMapChanged(self, uiMapID)

GameTooltip

 * OnTooltipAddMoney(self, cost, maxcost) - Run when an amount of money should be added to the tooltip.
 * OnTooltipCleared(self) - Run when the tooltip is hidden or its content is cleared.
 * OnTooltipSetAchievement(self) - Run when the tooltip is filled with information about an achievement.
 * OnTooltipSetDefaultAnchor(self) - Run when the tooltip is repositioned to its default anchor location.
 * OnTooltipSetEquipmentSet(self) - Run when the tooltip is filled with information about an equipment set.
 * OnTooltipSetFramestack(self, highlightFrame) - Run when the tooltip is filled with a list of frames under the mouse cursor.
 * OnTooltipSetItem(self) - Run when the tooltip is filled with information about an item.
 * OnTooltipSetQuest(self) - Run when the tooltip is filled with information about a quest.
 * OnTooltipSetSpell(self) - Run when the tooltip is filled with information about a spell.
 * OnTooltipSetUnit(self) - Run when the tooltip is filled with information about a unit.

Model
PlayerModel / TabardModel inherit the handlers from Model.
 * OnAnimFinished(self) - Run when the model's animation finishes.
 * OnAnimStarted(self)
 * OnModelLoaded(self)

CinematicModel

 * OnPanFinished

DressUpModel

 * OnDressModel(self)

MovieFrame

 * OnMovieFinished(self) - Run when a movie frame's movie ends.
 * OnMovieHideSubtitle(self) - Runs when the movie's most recently displayed subtitle should be hidden.
 * OnMovieShowSubtitle(self, text) - Runs when a subtitle for the playing movie should be displayed.

ScrollFrame

 * OnHorizontalScroll(self, offset) - Run when the scroll frame's horizontal scroll position changes.
 * OnScrollRangeChanged(self, xrange, yrange) - Run when the scroll frame's scroll position is changed.
 * OnVerticalScroll(self, offset) - Run when the scroll frame's vertical scroll position changes.

Slider

 * OnMinMaxChanged(self, min, max) - Run when the slider's or status bar's minimum and maximum values change.
 * OnValueChanged(self, value, userInput) - Run when the slider's or status bar's value changes.

StatusBar

 * OnMinMaxChanged(self, min, max) - Run when the slider's or status bar's minimum and maximum values change.
 * OnValueChanged(self, value) - Run when the slider's or status bar's value changes.

ModelSceneActor
Scripts for this widget can only be set from XML.
 * OnAnimFinished(self)
 * OnModelLoaded(self)
 * OnModelLoading