View Single Post
03/25/20, 08:43 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
For inventory context menus PLEASE PLEASE PLEASE use LibCustomMenu (https://www.esoui.com/downloads/info...ustomMenu.html) to assure it does not throw any security related errors anymore and all other addons work properly!
And do not prehook any context menu stuff but use the RegisterContextMenu functions of the librray! See the lib documentation for further details please, search at teh description for "lib:RegisterContextMenu".

Edit:
Benefit is also that the lib will provide some functions like register a context menu for normal right click and for right click + mopdifier key (alt, shift, ctrl).
Other addons already use their own ways toa chieve this like FCOItemSaver does with SHIFT+RIGHT click. This will make them all work properly together and NOT show any contextmenus where they are not wanted to be shown (e.g. clicked right+shift = show a 2nd context menu and not the normal one -> Your prehook would destroy this or show the normal context menu entries then as well).



For the chat it's posible as well, and you also should use AddCustomMenuEntry of LibCustomMenu here. Let me find an example from my WishList addon e.g.

Lua Code:
  1. local function linkContextMenu(link, button, _, _, linkType, ...)
  2.     if button == MOUSE_BUTTON_INDEX_RIGHT and linkType == ITEM_LINK_TYPE then
  3.        local itemType = GetItemLinkItemType(link)
  4.        ...
  5.        AddCustomMenuEntry(...)
  6.     end
  7. end
  8.  
  9.  
  10.     --Link handler (for right clicking an item in chat, etc.)
  11.     LINK_HANDLER:RegisterCallback(LINK_HANDLER.LINK_MOUSE_UP_EVENT, linkContextMenu)

Last edited by Baertram : 03/25/20 at 08:49 AM.
  Reply With Quote