View Single Post
09-22-22, 07:23 AM   #9
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,935
Based on the example on this page
https://wowpedia.fandom.com/wiki/Sec...ButtonTemplate

Have you tried changing type and macrotext to type1 and macrotext1 for left button click as these are attributes as SDPhantom mentioned. Although, I think ( not 100% sure ), that left button is default so maybe macrotext with no number is treated as macrotext1 :shrugs:

Just tested this version of your code using your original sit test on the PTR just now ( there was a big update ) and it worked

Lua Code:
  1. local frame = CreateFrame("Frame", "Test", UIParent, "SecureHandlerStateTemplate")
  2. frame:SetSize(40, 40)
  3. frame:SetPoint("TOPLEFT", UIParent, 10, -150)
  4.  
  5. local button = CreateFrame("Button", "TestBtn", frame, "SecureActionButtonTemplate")
  6. button:ClearAllPoints()
  7. button:SetSize(32, 32)
  8. button:SetPoint("CENTER", frame)
  9. local texture = button:CreateTexture("$parent_tex", "BACKGROUND")
  10. texture:SetAllPoints(true)
  11. texture:SetTexture(GetSpellTexture(783)) -- "Travel Form"
  12. button.texture = texture
  13.  
  14. button:RegisterForClicks("LeftButtonUp", "RightButtonUp")
  15. button:SetMouseClickEnabled(true)
  16. button:SetAttribute("type1", "macro")
  17. button:SetAttribute("macrotext1", "/sit")
  18.  
  19. ------ testing purpose
  20. button:SetScript("PostClick", function(self, arg1)
  21.     print("POSTCLICK: Clicked button=", self:GetName(), "  macroTxt=", self:GetAttribute("macrotext1"))
  22. end)
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 09-22-22 at 07:43 AM.
  Reply With Quote