View Single Post
05/10/14, 07:57 AM   #2
BadVolt
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 74
I have some movements with my question.

1st. Register an event to initialize hooking link clicks
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("IRememberYou", EVENT_PLAYER_ACTIVATED, HookChatLink)

2nd. Hooking itself.
Lua Code:
  1. local function HookChatLink()
  2.     for i=1,#ZO_ChatWindow.container.windows do
  3.         ZO_PreHookHandler(ZO_ChatWindow.container.windows[i].buffer,"OnLinkClicked",HookChatLinkClicked)
  4.     end
  5. end

3rd. Function to add item to the end of current list and resise ZO_Menu
Lua Code:
  1. local function HookChatLinkClicked(self, linkData, linkText, button, ctrl, alt, shift, command)
  2.     -- thx Kentarii
  3.     local linkType, _, _ = zo_strsplit(":", linkData)
  4.  
  5.     -- add our menu only to player linktype
  6.  
  7.     if linkType ~= CHARACTER_LINK_TYPE and linkType~=DISPLAY_NAME_LINK_TYPE then return end
  8.  
  9.     -- We want our item added after all items. So, wait untill they are created. Littly hacky, but... :banana:
  10.     zo_callLater(
  11.         function ()
  12.  
  13.             ZO_Menu:SetHeight(ZO_Menu:GetHeight()+22.3125)
  14.  
  15.             AddMenuItem("Rate", YourFunction)
  16.  
  17.         end
  18.     , 1)
  19. end

But now I have another problem... When I move mouse over new item it does not selects properly. It works sometimes, but I can't repeat it manually.


  Reply With Quote