I'm trying to convert some of the code I've already written from XML to Lua, to get rid of the unnessary global variables created and also so I can make a wrapper class which can dynamically create the style of frames that I want. So I have an XML file which looks like this:
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Frame name= "ClassBigFrame" parent="UIParent" toplevel="true" movable="true" hidden="false">
<Size x="100" y="100"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Backdrop bgFile="Interface\Tooltips\UI-Tooltip-Background"
edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true">
<EdgeSize>
<AbsValue val="16"/>
</EdgeSize>
<TileSize>
<AbsValue val="16"/>
</TileSize>
<BackgroundInsets>
<AbsInset left="5" right="5" top="5" bottom="5"/>
</BackgroundInsets>
</Backdrop>
</Frame>
</Ui>
I've tried to convert it to a Lua file which looks like this:
Code:
frame = CreateFrame("Frame","ClassBigFrame",UIParent)
frame:SetMovable(true)
frame:SetToplevel(true)
frame:SetBackdrop( {
bgFile = "Interface\Tooltips\UI-Tooltip-Background",
edgeFile = "Interface\Tooltips\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
} )
frame:SetWidth(100)
frame:SetHeight(100)
frame:SetPoint("CENTER")
frame:Show()
They should both do the same thing, but the XML creates a visible tooltip-like window in the middle of the screen, and the Lua file fails to do that (nothing is visible at all). I know that it is getting processed and the interface thinks its visible since if I add a text string as a child in both cases, I get the text floating in the middle of the screen in the Lua file. So what's the difference between the way these two files are handled?