How to create a/add to inventory context menu

From ESOUI Wiki

(Difference between revisions)
Jump to: navigation, search
(Explanation)
(Examples)
Line 23: Line 23:
Please read the library description for examples!
Please read the library description for examples!
[https://www.esoui.com/downloads/info1146-LibCustomMenu.html]
[https://www.esoui.com/downloads/info1146-LibCustomMenu.html]
-
 
-
The examples also show you how to determien the bagId and slotIndex of the current's inventoryRow.
 

Revision as of 20:49, 25 March 2020

Explanation

The inventory context menu (right click on an inventory row to show it) contains some pre-defined actions that could be taken with an inventory item.
You might have the need to add some enties of your addon to rhis context menu.
There is an easy way to do this: The library LibCustomMenu.

Please see description of the library LibCustomMenu on this wbesite if you want to use the library to register and use the context menu
[1]

The library provides functions to register a context menu:

lib:RegisterContextMenu(func, category)

The function "func" needs to have the following format:

local function func(inventorySlot, slotActions)
  --Exampole code to determine the bagId, slotIndex an itemLink of the current inventoryRow (inventorySlot)
    local bagId, slotIndex = ZO_Inventory_GetBagAndIndex(inventorySlot)
    local itemLink = GetItemLink(bagId, slotIndex)
end

The library also provides other fucntions to respect the keybinds and the determination of the action slots in the context menu.

Examples

Please read the library description for examples! [2]

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox