Changes the mouse cursor image. Changes only the appearance of the mouse cursor, not its behavior (and has no effect if the cursor is holding an item, spell, or other data). Passing nil
will revert the cursor to its default image.
Normally used in a frame's OnEnter
handler to change the cursor used while the mouse is over the frame. If used elsewhere, the cursor will likely be immediately reverted to default (due to the mouse handlers of other frames doing the same).
See also Cursor functions.
Signature:
SetCursor("cursor")
Arguments:
cursor
- Path to a texture to use as the cursor image (must be 32x32 pixels) or one of the built-in cursor tokens. Valid cursor tokens can be found in the example code. (string
)
Examples:
-- Creates a button in the center of the screen which can be moused over -- repeatedly to show all of the available cursors local cursors = { "NORMAL_CURSOR", "ATTACK_CURSOR", "ATTACK_ERROR_CURSOR", "BUY_CURSOR", "BUY_ERROR_CURSOR", "CAST_CURSOR", "CAST_ERROR_CURSOR", "GATHER_CURSOR", "GATHER_ERROR_CURSOR", "INNKEEPER_CURSOR", "INNKEEPER_ERROR_CURSOR", "INSPECT_CURSOR", "INSPECT_ERROR_CURSOR", "INTERACT_CURSOR", "INTERACT_ERROR_CURSOR", "ITEM_CURSOR", "ITEM_ERROR_CURSOR", "LOCK_CURSOR", "LOCK_ERROR_CURSOR", "LOOT_ALL_CURSOR", "LOOT_ALL_ERROR_CURSOR", "MAIL_CURSOR", "MAIL_ERROR_CURSOR", "MINE_CURSOR", "MINE_ERROR_CURSOR", "PICKUP_CURSOR", "PICKUP_ERROR_CURSOR", "POINT_CURSOR", "POINT_ERROR_CURSOR", "QUEST_CURSOR", "QUEST_ERROR_CURSOR", "REPAIRNPC_CURSOR", "REPAIRNPC_ERROR_CURSOR", "REPAIR_CURSOR", "REPAIR_ERROR_CURSOR", "SKIN_ALLIANCE_CURSOR", "SKIN_ALLIANCE_ERROR_CURSOR", "SKIN_CURSOR", "SKIN_ERROR_CURSOR", "SKIN_HORDE_CURSOR", "SKIN_HORDE_ERROR_CURSOR", "SPEAK_CURSOR", "SPEAK_ERROR_CURSOR", "TAXI_CURSOR", "TAXI_ERROR_CURSOR", "TRAINER_CURSOR", "TRAINER_ERROR_CURSOR" } local current = 0 CreateFrame("Button", "CursorTestFrame", UIParent, "GameMenuButtonTemplate") CursorTestFrame:SetPoint("CENTER", 0, 0) CursorTestFrame:SetText("Hover to change cursor") local function OnEnter(self) current = current + 1 if current > #cursors then current = 1 end SetCursor(cursors[current]) self:SetText(cursors[current]) end CursorTestFrame:SetScript("OnEnter", OnEnter) SetDungeonDifficulty