WoWInterface (
-   Lua/XML Help (
-   -   Access frame by name (

maqjav 09-03-17 02:39 PM

Access frame by name

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?


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")
  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