View Single Post
03/26/20, 08:38 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
You could even try to skip the zo_callLater function at all, not sure if this will make a difference there.
I think I had added it to assure it will add the the menu entries after the exisitng ones, as the callback function fires as the link_handler MouseUp fores.
But I think the ZOs code will be run first and then the other link handler callback functions (not sure about this though!)

Try to remove the zo_callLater and check if it works properly, maybe also add WishList as an addon to test what happens if multiple addons add context menus to the itemlinks in chat items.

For the guild store contextmenus I'd assume this is either added to any guildstore related addon like AwesomeGuildStore already (maybe use Notepad++ -> menu search -> search in files to search the live/AddOns/AwesomeGuildStore folder for AddMenuItem (if you find these tell sirinsidiator to use LibCustomMenu instead please ) or AddCustomMenuItem and see if this is used anywhere as context menu (could be an own created context menu at own controls as well though).

I'll have alook at the esoui src code later if I can find a proper way to add a context menu entry there.

Edit:
TradingHouse should be a normal ZO_Inventory I think.
Try if adding a context menu to normal inventory, like described above with LibCustomMenu:RegisterContextMenu) items will be shown at the trading house search results as well.
You would need to check via e.g. the slotControl of the callback function if you are at the trading house (GetParent or GetOwner or whatever should return something like TRADING_HOUSE then) and maybe only add those entries you need there.

If this does not work, maybe ask Sirinsidiator at the gitter IM.

Edit2:
Could also work:
SecurePostHook ZO_TradingHouse_OnSearchResultClicked(searchResultSlot, button) and check if button = MOUSE_BUTTON_INDEX_RIGHT, then show your context menu on the searchResultSlot.

Right mouse will preview items already so you need to be carefull if your context menu will fail to show because of any preview action taking place etc.
The code used there to check if a preview can take place is:

Lua Code:
  1. local tradingHouseIndex = GetTradingHouseIndexForPreviewFromSlot(searchResultSlot)
  2.         if tradingHouseIndex ~= nil then
  3.         --Preview item
  4.         end

So you only need to check the same in your SecurePostHook and if tradingHouseIndex == nil show your contextmenu instead. This should take care of this.

Last edited by Baertram : 03/26/20 at 08:47 AM.
  Reply With Quote