View Single Post
09-22-22, 11:48 AM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Zax View Post
I have to say that I'm not sure how to adapt my code based on what you found.
As for Button:RegisterForClicks(), change this
Code:
button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
to either of these
Code:
button:RegisterForClicks("LeftButtonUp", "LeftButtonDown", "RightButtonUp", "RightButtonDown")
Code:
button:RegisterForClicks("AnyUp", "AnyDown")


Originally Posted by Zax View Post
Also, I believe the code you found concerns the raid markers (placed on units) and not the ground markers (placed on... the ground ).
RaidTarget is what's placed on units and WorldMarker is placed on the ground. RaidTargets aren't protected, so they don't need a SecureActionButton to set.

RaidTargets are set by SetRaidTarget() while WorldMarkers have PlaceRaidMarker() and ClearRaidMarker().
(WoWPedia doesn't have an API page on the WorldMarker functions)

Here's an example of your button configured for this.
Lua Code:
  1. button:SetMouseClickEnabled(true);--    Make sure OnClick is enabled
  2. button:RegisterForClicks("AnyUp","AnyDown");--  Listen for all mouse buttons (Both up and down are required for SecureActionButtonTemplate)
  3.  
  4. button:SetAttribute("type","worldmarker");--    Perform "WorldMarker" action
  5. button:SetAttribute("marker",1);--  Use marker index 1
  6. button:SetAttribute("action1","toggle");--  Set left button to toggle
  7. button:SetAttribute("action2","clear");--   Set right button to force clear



Originally Posted by Xrystal View Post
Although, I think ( not 100% sure ), that left button is default so maybe macrotext with no number is treated as macrotext1 :shrugs:
The default without the number suffix is to run on any button. Specifying one is useful if you want the same SecureActionButton to perform different actions depending on what mouse button you click it with and/or what modifier keys are held.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 09-22-22 at 12:07 PM.
  Reply With Quote