Thread Tools Display Modes
09-03-17, 02:39 PM   #1
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
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.
  Reply With Quote
09-03-17, 03:09 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
local frame = _G["FrameName"]
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-03-17, 03:10 PM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
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)
  Reply With Quote
09-03-17, 11:56 PM   #4
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Access frame by name

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off