Thread Tools Display Modes
04/24/19, 09:13 PM   #1
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 132
Unhappy [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)
  Reply With Quote
04/25/19, 04:31 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
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

Last edited by Baertram : 04/25/19 at 04:42 AM.
  Reply With Quote
04/25/19, 09:42 AM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
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.
  Reply With Quote
04/25/19, 01:21 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I did not enable this "on purpose". Maybe another addon did this then.
  Reply With Quote
04/26/19, 10:58 PM   #5
Phuein
 
Phuein's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 132
Originally Posted by Baertram View Post
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.

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:
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)....

Last edited by Phuein : 04/27/19 at 11:52 AM.
  Reply With Quote

ESOUI » Developer Discussions » Bug Reports » [notabug] No middle mouse button for mail attachment.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off