In my addon, I have a TextBuffer and TextLabel where I create custom links to do various actions.
XML:
Code:
<OnLinkClicked>
HoWUI.QuestJournal:OnLinkClicked(self, linkData, linkText, button, ctrl, alt, shift, command)
</OnLinkClicked>
Lua:
Lua Code:
--- Event handler for OnLinkClicked in TextBuffer control.
-- @param self
-- @param linkData string the link url: url:SomeLinkTargetOrUrl[SomeLinkText]
-- @param linkText string the link text: [SomeLinkText]
-- @param button int the mousebutton clicked, 1 = left, 2 = right, 3 = middle
-- @param ctrl bool true if ctrl was pressed during click.
-- @param alt bool true if alt was pressed during click.
-- @param shift bool true if shift was pressed during click.
-- @param command bool true if command (Mac I assume) was pressed during click.
-- @return void
function module:OnLinkClicked(_self, linkData, linkText, button, ctrl, alt, shift, command)
local linkType, arg1, arg2 = zo_strsplit(":", linkData)
if linkType == "quest" then
local zoneName = arg1
local questName = arg2
if button == 1 then
-- left click
elseif button == 2 then
-- right click
end
elseif linkType == "filter" then
local state = tonumber(arg1)
if button == 1 then
-- snip
end
elseif linkType == "zone" then
local zoneName = arg1
if button == 1 then
end
end
end
Links:
Code:
|H6699FF:quest:ExampleZoneName:SomeQuestName:|hSomeQuestName|h
|HFF9933:zone:ExampleZoneName:|hExampleZoneName|h
|HFFFFFF:filter:1:|h123|h
You can also check this page for more info
http://wiki.esoui.com/How_to_create_custom_links