Quantcast
WoWInterface - View Single Post - Right mouse button clicks on menu buttons
View Single Post
06-16-15, 06:47 AM   #4
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
It can be done, but it's a bit hacky.

First hook the function that creates menu buttons to make sure they're registered for right clicks. (unless you have a reason to use *Down, I'd use *Up instead, as that's what the rest of the UI uses)
Code:
local function createFramesHook(numLevels, numButtons)
	for level = 1, numLevels do
		for i = 1, numButtons do
			_G["DropDownList"..level.."Button"..i]:RegisterForClicks("LeftButtonUp", "RightButtonUp")
		end
	end
end

createFramesHook(UIDROPDOWNMENU_MAXLEVELS, UIDROPDOWNMENU_MAXBUTTONS)
hooksecurefunc("UIDropDownMenu_CreateFrames", createFramesHook)
Then use GetMouseButtonClicked() in func to determine which button was clicked.
__________________
Grab your sword and fight the Horde!
  Reply With Quote