View Single Post
01-15-24, 06:37 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,961
Ah gotcha.

Not played with that (DoCraft) functionality myself but ..

https://warcraft.wiki.gg/wiki/Secure...rClickTemplate

Creating a button from a SecureHandlerClickTemplate would be a starting point as that would let you use a button to do something that is part of the secure frame system. This gives you a brief example but bear in mind that you have to pass information into the secure system for it to be accessible. The example creates 2 frame variables to use the frames.

Now, whether, protected functions work this route I don't know.

Looking at nUI there is a secure click button in use there with a somewhat simple set up. So I will grab out it's code as an example. I'm not sure how successful this will be for your task, as the button nUI uses just activates the visibility of another frame, so just comment out your code or make a copy of the file in case you need to go back to it.


Lua Code:
  1. local mysecurebutton       = CreateFrame( "Button", "MySecureButtonName", UIParent, "UIPanelButtonTemplate,SecureHandlerClickTemplate" )
  2. mysecurebutton:SetPoint("CENTER")
  3. mysecurebutton:SetSize(100, 40)
  4. mysecurebutton:SetText("DoCraft")
  5.  
  6. mysecurebutton:SetAttribute(
  7.     "_onclick",
  8.     [[
  9.         local index = self:GetAttribute( "craftselectionindex" )
  10.         DoCraft(index)
  11.     ]]
  12. )
  13.  
  14.  
  15. -- Somewhere in the rest of your code make sure this line is called before clicking the button
  16. mysecurebutton:SetAttribute( "craftselectionindex", GetCraftSelectionIndex() )

For reference this is a page of info regarding the secure handlers
https://warcraft.wiki.gg/wiki/SecureHandlers
__________________


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 : 01-15-24 at 06:44 AM.
  Reply With Quote