Posted by jaren on Tue, 05 Mar 2013 19:06:04
Bit of a strange one but I am currently conducting some academic research into increasing the accessibility of online games such as World of Warcraft for players with certain types of disabilities.
As part of this I am trying to create a context menu that appears wherever the cursor is on the screen. I can currently get this to work by binding it to a key on my keyboard, but I need it to trigger from the middle mouse button (or failing that, the right mouse button).
UIParent:SetScript("OnMouseDown", function(self, click) print("Click: ",click); checkAndCreateRadial(); end)
By using the code above I have managed to get this working so that ALL mouse clicks are received and checked for the middle mouse, but this obviously prevents users from interacting with the screen as normal.
Is there any way to only listen for middle mouse events, either using SetScript or otherwise?
I'm afraid I'm merely a Java and C programmer so still getting to grips with LUA, but have been trying to resolve this for nearly 3 days and starting to worry it can't be done.
Thanks in advance, J
Posted by jaren on Tue, 05 Mar 2013 20:12:24
And of course, as is typically the case, I managed to solve it an hour after asking for help.
SetOverrideBindingClick(UIParent, false, "Button3", "menuButton", "MiddleButton");
The code above worked (with menuButton having an OnClick script triggering the radial menu creation. Previous attempts had not worked due to trying to use "MiddleButton" instead of "Button3".
Hopefully this might help someone else in the future!