Having issues with secureactionbuttontemplate.
Hi there,
I am currently using the lockdown to finally get round to making my own addon, after 15 years of thinking wouldn't it be nice if I had this addon! Anyway, my experience with Lua is pretty poor, I am reasonably good with basic php so I'm not a complete coding novice. I am currently making an addon to keep track of my professions on my characters, known patterns, show trainer locations etc etc. So far it has been going well, until I started getting involved with the Enchanting profession! Before I rant on and bore you to death with the details of my struggle, the issue I would like some help with is this; I have a button in my frame which when clicked will open my bags, and cast disenchant. I then discovered its a protected 'spell'. So after doing some googling on the secure template I tried to get it working, but now my button has vanished from the frame. I know the path to my texture works, as it was there before I added the secure template. It could just be weary eyes, but I can't figure out whats wrong with my code. I would be very grateful is someone could help me with this issue. Here is my code: Code:
-- Make top frame |
Set the button NormalTexture rather than creating a separate icon texture.
This sets it to the standard bag icon. Code:
btn:SetNormalTexture("Interface/Buttons/Button-Backpack-Up"); |
It made no difference, apart from making my code shorter and cleaner, which I am grateful for showing me a better way of doing it.
I believe the issue is definitely related to the secure template. If I remove the reference to the template, the button displays correctly. When using framestack the button and all parents are anchored correctly. As soon as I set the secure template, the button vanishes, the parent frame to the button remains visible. I tried removing the texture and using a solid colour background instead, again no button with the same results from framestack. |
Using secure template doesn't mean you can use features like CastSpellByName, the template handle the OnClick for you, so you can only set attributes on the button.
For simple, we can bind the macro to the button: Lua Code:
|
Well according to https://wowwiki.fandom.com/wiki/Secu...ButtonTemplate it is possible. I realise I hadn't commented out my old onclick function, (which is how I discovered disenchant was protected) but the execution of the button isn't my issue. I just can't see the button when using the secure template.
|
Hmm, I'm not 100% sure, but I thought I found that the new SecureActionButtonTemplate isn't a visual template just handles the secure elements.
You would have to add in the visual elements or combine it with a visual template. Granted the following is an XML version but the same thing should apply when creating by code. Lua Code:
As you can see by this my spell button is actually a combination of an icon button template and the secureactionbuttontemplate As you can see from this link the secureactionbuttontemplate only handles the onclick event https://www.townlong-yak.com/framexm...eTemplates.xml So, moving from your old button template to the new button template you have inadvertently removed the visual functionality of the button. This is a collection of Blizzards ActionButtonTemplates. https://www.townlong-yak.com/framexm...onTemplate.xml As you can see these don't have any onclick functionality as Blizzard has separated them. |
Quote:
https://wow.gamepedia.com/Wowpedia |
Quote:
I have also just solved my issue too; InsecureActionButtonTemplate rather than SecureActionButtonTemplate. 6 hours of trying different things for the sake of 2 letters. |
All times are GMT -6. The time now is 06:06 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI