UIHANDLER OnHyperlinkClick

From Warcraft Wiki
Jump to navigation Jump to search

Fires when clicking a hyperlink.

(self, link, text, button, region, left, bottom, width, height)

Arguments

self
Frame - The widget registered for this script handler.
link
string - The link payload (e.g. "item:6948:0:0:0:...").
text
string - The link label (e.g. "[Hearthstone]").
button
string - "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5", ..., "ButtonN"
region
Region - The Region the hyperlink belongs to.
left
number - The x position of the hyperlink in pixels, relative to the region top left corner.
bottom
number - The y position of the hyperlink in pixels, relative to the region top left corner.
width
number - Hyperlink width in pixels.
height
number - Hyperlink height in pixels.


Details

Examples

Using ChatFrame_OnHyperlinkShow() to mimick the default chat frames.[1]

local frame = CreateFrame("ScrollingMessageFrame")
frame:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)


Responding to a hyperlink contained in a child FontString.

local frame = CreateFrame("Frame")
frame:SetPoint("CENTER")
frame:SetSize(200, 50)
frame:SetHyperlinksEnabled(true)
frame:SetScript("OnHyperlinkClick", function(self, link, text, button)
	SetItemRef(link, text, button, self)
end)

local fontString = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
fontString:SetAllPoints()
fontString:SetText(select(2,GetItemInfo(6948)))

Patch changes

WoW Icon update.png Patch 1.6.0 (2005-07-12): Added text argument.[2]

References