Thread: XML to Lua?
View Single Post
04-01-24, 11:04 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,895
In XML, where you see parentKey, that is convert to a key on the parent frame (funny that)
Code:
<Button parentKey="CloseButton" inherits="UIPanelCloseButtonDefaultAnchors"/>
Would become:
Lua Code:
  1. frame.CloseButton = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
  2. frame.CloseButton:SetPoint("TOPRIGHT", -4, -4)

Because the parent frame has a (not very unique) name you can access the child frame (CloseButton) via the parent's key

Lua Code:
  1. SimpleFrame.CloseButton:Click()
would be the same as the mouse clicking the close button
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote