Shift middle click an item for GetItemInfo
I would like to be able to Shift Middle click an item in my bags and have it call GetItemInfo on that item, but I'm not sure where to start.
I've done some google-ing and can't find anything myself so any help would be great. |
You could hook the OnClick event of the frames.
Lua Code:
Another way doing it would be to hook Blizzards ContainerFrameItemButton_OnModifiedClick(self, button). Like Lua Code:
I bet Phanx likes this one more because it's using only one hook and not 5x36. ;D |
That's exactly what I was looking for! Thanks a bunch ^.^
I do get one error though, it seems only left and right button are passed, for example in the script below... Lua Code:
Only left and right clicks will print anything, this is not a huge deal as I can easily switch the keybinds though, just curious why that is. |
I believe you need to call button:RegisterForClicks('MiddleButtonDown') if it's not already watching for that type of click.
|
I'm not sure. Maybe the middle button is not registered.
I don't have a 3 button mouse available atm and can't test it. :) Try to register for MiddleButtonDown: Lua Code:
See http://www.wowwiki.com/API_Button_RegisterForClicks for reference. |
Ah, you guys are correct!
Everything is working now, thank you so much for your help. :D |
Edit: I guess I should refresh the page before typing my reply when it's been sitting on the reply page for 2 hours because I got distracted by work, but oh well. Leaving this here anyway. :p
On its own, "calling GetItemInfo" won't actually do anything: Code:
/run GetItemInfo(6948) Lua Code:
You probably also need to tell the buttons to respond to middle-clicks, instead of just left- and right-clicks: Lua Code:
If you're using a third-party bag addon that doesn't reuse the Blizzard item buttons, you'll need to modify its buttons and hook its click-handling function instead. |
I had a problem that I wasn't aware of until just recently that I could not sell items normally which I resolved by reading the code you have submitted and registering clicks for AnyUp, the sell part was also very useful, I will definitely be using that. =D
Again, I appreciate the help, thank you. :) |
All times are GMT -6. The time now is 10:03 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI