Wowpedia
Advertisement
Wowpedia
240,425
pages

Registers a Button for mouse clicks.

button:RegisterForClicks([button1,  ...])

Arguments

button1, ... 
string?Optional. Could be nil. - Any number of the following button types, or leave empty (nil) to register to none:
  • "AnyUp"
  • "AnyDown"
  • "RightButtonUp" (default)
  • "LeftButtonDown"
  • "MiddleButtonUp"
  • "MiddleButtonDown"
  • "RightButtonDown"
  • "Button4Up"
  • "Button4Down"
  • "Button5Up"
  • "Button5Down" (and so on)

Details

Example

<Button>
	<Scripts>
		<OnLoad>
	 		self:RegisterForClicks("LeftButtonUp", "RightButtonDown");
		</OnLoad>
		<OnClick>
			print("OnClick: "..button);
		</OnClick>
		<OnMouseUp>
			print("OnMouseUp: "..button);
		</OnMouseUp>
		<OnMouseDown>
			print("OnMouseDown: "..button);
		</OnMouseDown>
	</Scripts>
</Button>

Results

Clicking the Left, Right and Middle buttons in turn will produce:

 OnMouseDown: LeftButton

 OnMouseUp: LeftButton
 OnClick: LeftButton

 OnMouseDown: RightButton
 OnClick: RightButton

 OnMouseUp: RightButton

 OnMouseDown: MiddleButton

 OnMouseUp: MiddleButton
Advertisement