ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Bug Reports (https://www.esoui.com/forums/forumdisplay.php?f=187)
-   -   [notabug] No middle mouse button for mail attachment. (https://www.esoui.com/forums/showthread.php?t=8488)

Phuein 04/24/19 09:13 PM

[notabug] No middle mouse button for mail attachment.
 
I've added a middle mouse button (number 3) event for my inventory items. When I try to do the same to mail attachments, it's the same event and it reports d() fine for buttons 1 and 2 (left and right buttons), but 3 (middle) is not recognized at all.

Please verify and fix. ty xoxo

Code:

ZO_PreHook("ZO_InventorySlot_OnSlotClicked", function(inventorySlot, button) d(button) end)

Baertram 04/25/19 04:31 AM

No bug - Mouse driver issue or code param "button" globally known and wrong?
 
Just a guess but is there an OnMouseUp event for the inventorySlots as well and did you try if this function works for the middle mouse?
I got some problems with OnClick events in the past and toptally changed to the OnMosueDown and OnMouseUp stuff then, as e.g. labels or other controls don't have an OnClicked event as it seems.

Edit:
Seems there is only this global function, so this really might be a bug if MOUSE_BUTTON_INDEX_MIDDLE is not given

Lua Code:
  1. function ZO_InventorySlot_OnSlotClicked(inventorySlot, button)
  2.     inventorySlot = ZO_InventorySlot_GetInventorySlotComponents(inventorySlot)
  3.     if button == MOUSE_BUTTON_INDEX_LEFT then
  4.         -- Left clicks are only used as drops at the moment, use the receive drag handlers
  5.         ZO_InventorySlot_OnReceiveDrag(inventorySlot)
  6.     elseif button == MOUSE_BUTTON_INDEX_RIGHT then
  7.         -- Right clicks only open the context menu
  8.         if ShouldHandleClick(inventorySlot) then
  9.             ZO_InventorySlot_ShowContextMenu(inventorySlot)
  10.         end
  11.     end
  12. end

I'll test this also with my mouse, maybe it's a driver issue or whatever. Will report here

Edit:
After some tests it works fine for me and my mouse.
Also on the mail send panel!
Chat output will be:


So this seems to be related to your code (maybe change the variable name button to p_button like I did!) or to your mouse driver

sirinsidiator 04/25/19 09:42 AM

Did you enable the mouse button on the control you are using the onclicked handler on?
Per default only the left mouse button is active and you have to manually enable any additional buttons you wish to use via "control:EnableMouseButton(mouseButton, enable)". Otherwise the OnClicked handler won't fire for them.

Baertram 04/25/19 01:21 PM

I did not enable this "on purpose". Maybe another addon did this then.

Phuein 04/26/19 10:58 PM

Quote:

Originally Posted by Baertram (Post 37899)
I did not enable this "on purpose". Maybe another addon did this then.

Looks like another addon has enabled this for you. Try again without any addons. My tests are very clear: in mail inbox buttons 1 and 2 show, but 3 doesn't - while all three buttons show with inventory.

Quote:

Originally Posted by sirinsidiator
Did you enable the mouse button on the control you are using the onclicked handler on?
Per default only the left mouse button is active and you have to manually enable any additional buttons you wish to use via "control:EnableMouseButton(mouseButton, enable)". Otherwise the OnClicked handler won't fire for them.

Thanks, your suggestion works. Very awkward that it takes a function, because now I'm awkwardly wondering where to apply it. I can't apply it on click, naturally, and there's no available mouse-over event to pre-hook. The ZO_Inventory_BindSlot pre-hook won't work, as it happens before my addon is even loaded. Such a pain for a small thing.

After searching about, prehooking here did the trick:
Quote:

ZO_PreHook("ZO_Inventory_SetupSlot", AddMiddleMouseButton)
Now back to being stuck with finding where the mail attachmentSlot keeps the item name, as it's not a real slot (no bagid) and not a row (no proper data)....


All times are GMT -6. The time now is 07:01 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI