View Single Post
05/08/14, 02:38 AM   #4
Kentarii
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
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:
  1. --- Event handler for OnLinkClicked in TextBuffer control.
  2. -- @param self
  3. -- @param linkData string the link url:     url:SomeLinkTargetOrUrl[SomeLinkText]
  4. -- @param linkText string the link text:    [SomeLinkText]
  5. -- @param button int the mousebutton clicked, 1 = left, 2 = right, 3 = middle
  6. -- @param ctrl bool true if ctrl was pressed during click.
  7. -- @param alt bool true if alt was pressed during click.
  8. -- @param shift bool true if shift was pressed during click.
  9. -- @param command bool true if command (Mac I assume) was pressed during click.
  10. -- @return void
  11. function module:OnLinkClicked(_self, linkData, linkText, button, ctrl, alt, shift, command)
  12.     local linkType, arg1, arg2 = zo_strsplit(":", linkData)
  13.     if linkType == "quest" then
  14.         local zoneName = arg1
  15.         local questName = arg2
  16.         if button == 1 then
  17.         -- left click
  18.         elseif button == 2 then
  19.         -- right click
  20.         end
  21.     elseif linkType == "filter" then
  22.         local state = tonumber(arg1)
  23.         if button == 1 then
  24.         -- snip
  25.         end
  26.     elseif linkType == "zone" then
  27.         local zoneName = arg1
  28.         if button == 1 then
  29.         end
  30.     end
  31. 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
  Reply With Quote