OK.
I still have an annoying problem: as the up and down mouse button are registered, it triggers the action twixe.
I can handle this on the PostClick script with the third argument, but I don't know how to handle the main action - the one defined as a shit-click macro.
For example, line #6 is executed twice
Lua Code:
btnMarker:SetMouseClickEnabled(true) -- Make sure OnClick is enabled
btnMarker:RegisterForClicks("LeftButtonUp", "LeftButtonDown") -- up and down required for SecureActionButtonTemplate
btnMarker:SetAttribute("type", "macro")
local macroStr = format("/wm %d", markersOrder[i]) -- place ground marker #i
btnMarker:SetAttribute("macrotext1", macroStr)
btnMarker:SetAttribute("shift-macrotext1", "/say TESTING") -- executed twice !!!!!!!!
btnMarker:SetScript("PostClick", function(self, btn, isDown)
if (not isDown) then -- execute only when down
if (not IsModifierKeyDown()) then
-- do some stuff when mouseDown with modifier key
end
end
end)
BTW, it's for
NPCsMarker, a RP addon.