UIHANDLER OnClick

Called when the user clicks a button.
 (self, button, down)
== Arguments ==
; self : - Widget being clicked.
; button : - "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5", ..., "ButtonN"; however, virtual or overriden clicks have aribtrary values using (), () and ().
; down : - True when the button is pressed, false when it is released.
== Details ==
* () controls which mouse interactions will fire OnClick (defaults to "LeftButtonUp")
* Preceeded by , and ; and followed by .
* Blocked in the "up" direction by when it fires.
* Blocked in the "up" direction after dragging with a button , or any time if the cursor is moved off the widget and not brought back before releasing the mouse button.
== Example ==
A simple button that tells you how it was pressed.
local button = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
button:SetSize(200, 24)
button:SetPoint("CENTER")
button:RegisterForClicks("AnyUp", "AnyDown")
button:SetScript("OnClick", function (self, button, down)
	self:SetText((down and "Pressed " or "Pressed and released ") .. button)
end)
Alternatively, in XML.
<Button parent="UIParent" inherits="UIPanelButtonTemplate">
	<Size x="200" y="24" />
	<Anchors><Anchor point="CENTER" /></Anchors>
	<Scripts>
		<OnLoad>
			self:RegisterForClicks("AnyUp","AnyDown")
		</OnLoad>
		<OnClick>
			self:SetText((down and "Pressed " or "Pressed and released ") .. button)
		</OnClick>
	</Scripts>
</Button>