WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Access frame by name (https://www.wowinterface.com/forums/showthread.php?t=55714)

maqjav 09-03-17 02:39 PM

Access frame by name
 
Hello.

I'm using the template UIPanelDialogTemplate and I want to override the "OnClick" event of the close button, however I don't know how to access it because it doesn't have a parent key.

Can I do it using its name? How?


Thanks.

Fizzlemizz 09-03-17 03:09 PM

local frame = _G["FrameName"]

Kanegasi 09-03-17 03:10 PM

You said you were using it, right? The close button has a name, it's $parentClose, so it would be whatever you named your frame with Close at the end.

Lua Code:
  1. local myDialogFrame = CreateFrame("frame", "myDialogName", UIParent, "UIPanelDialogTemplate")
  2.  
  3. myDialogNameClose:SetScript("OnClick", function()
  4.     -- whatever
  5. end)

maqjav 09-03-17 11:56 PM

Thank you both.

Now I know how to access a frame by name, however I will try the second option, which seems the proper one in this case.


All times are GMT -6. The time now is 04:24 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI