Here's the OnClick handler on PTR.
Lua Code:
function SecureActionButton_OnClick(self, inputButton, down, isKeyPress)
local pressAndHoldAction = SecureButton_GetAttribute(self, "pressAndHoldAction");
local useOnKeyDown = GetCVarBool("ActionButtonUseKeyDown") or pressAndHoldAction;
local clickAction = (down and useOnKeyDown) or (not down and not useOnKeyDown);
local releasePressAndHoldAction = (not down) and (pressAndHoldAction or GetCVarBool("ActionButtonUseKeyHeldSpell"));
if clickAction then
OnActionButtonClick(self, inputButton, down, isKeyPress);
return true;
elseif releasePressAndHoldAction then
OnActionButtonPressAndHoldRelease(self, inputButton, isKeyPress);
return true;
end
return false;
end
-
FrameXML\SecureTemplates.lua:730
Basically, the handler is looking for either an up or down click event specifically according to how the
ActionButtonUseKeyDown CVar is set. If it never gets the matching click event, the code never runs. It's probably a good idea to register both up and down click events for every button you intend to respond to. If you don't care about registering individual buttons, you can use
"AnyUp" and
"AnyDown".
Originally Posted by Zax
the real macro is something like "/wm 1" or "/cwm 1" to place or clear ground markers.
|
This code clip may be of interest to you.
Lua Code:
SECURE_ACTIONS.worldmarker =
function(self, unit, button)
local marker = tonumber(SecureButton_GetModifiedAttribute(self, "marker", button));
local action = SecureButton_GetModifiedAttribute(self, "action", button) or "toggle";
if ( action == "set" ) then
PlaceRaidMarker(marker or 1);
elseif ( action == "clear" ) then
ClearRaidMarker(marker);
elseif ( action == "toggle" ) then
marker = marker or 1;
if ( IsRaidMarkerActive(marker) ) then
ClearRaidMarker(marker);
else
PlaceRaidMarker(marker);
end
end
end;
-
FrameXML\SecureTemplates.lua:589
This defines type
"worldmarker" with parameters
"marker" and
"action".
As with any other attribute fetched by
SecureButton_GetModifiedAttribute(), you can append the attribute name (not the value) with a number representing the mouse button to bind to (1=Left, 2=Right, 3=Middle, etc.)