Hi all!
I have a question, I need a simple snippet to make a button that, if you press with left mouse button, it will do something and if you press right mouse button it will do something else.
I tried a lot of codes like using registerForClicks and trying to use that code in order to get my snippet to work:
Code:
-- Illustrates the timing of mouse script handlers when clicking a button
local b = CreateFrame("Button", "TestButton", UIParent, "UIPanelButtonTemplate2")
b:SetPoint("CENTER")
b:RegisterForClicks("AnyDown")
local upDown = { [false] = "Up", [true] = "Down" }
local function show(text)
DEFAULT_CHAT_FRAME:AddMessage(text)
end
b:SetScript("OnMouseDown", function(self, button)
show(format("OnMouseDown: %s", button))
end)
Only I need a code to SendChatMessage something with one mouse button and SendChatMessage something else with the other mouse button but I can't get this >_<
Someone knows a simple snippet to get this working?