Widget/API/RegisterForClicks

Register any keys for capturing event on frames, buttons etc.
this function
 this:RegisterForClicks(keyname) 
should be placed in .xml file like
...
 <Frames>
 ...
 </Frames>
 <Scripts>
 <OnLoad>
 this:RegisterForClicks(keyname);
	</OnLoad>
 ...
keyname - name of the button, like "LeftButton", "RightButton" or "MiddleButton" mouse bottons
function RegisterForClicks can take more the one keyname at once
RegisterForClicks("LeftButton", "RightButton", "MiddleButton")
keep in mind, to check pressed key in .xml you should check uppercase names LBUTTON, RBUTTON, MBUTTON or XBUTTON
...
 <Frames>
 ...
 </Frames>
 <Scripts>
 <OnClick>
 if key == "LBUTTON" then
 ...
 end;
 </OnClick>
 ...
or
...
 <Frames>
 ...
 </Frames>
 <Scripts>
 <OnMouseUp>
 if key == "LBUTTON" then
 ...
 end;
 </OnMouseUp>
 ...
or
...
 <Frames>
 ...
 </Frames>
 <Scripts>
 <OnMouseDown>
 if key == "LBUTTON" then
 ...
 end;
 </OnMouseDown>
 ...
key - reserved name, will contain the name of event
== Related Functions ==
* IsShiftKeyDown
* IsAltKeyDown
* IsCtrlKeyDown
Category:Widget/API