I am trying to understand why I need to use SetAllPoints when creating a button in lua without a template vs with one. Here is the code that I'm using.
Lua Code:
local myButton1 = CreateFrame("Button", "TestButton1", UIParent)
myButton1:SetSize(64, 64)
myButton1:SetPoint("TOP", 32, 0)
myButton1.icon = myButton1:CreateTexture("$parentIconTexture", "BORDER")
myButton1.icon:SetTexture("Interface\\ICONS\\INV_Misc_Fish_58")
myButton1.icon:SetAllPoints() -- why?
local myButton2 = CreateFrame("Button", "TestButton2", UIParent, "TestButtonTemplate")
myButton2:SetSize(64, 64)
myButton2:SetPoint("TOP", -32, 0)
myButton2.icon:SetTexture("Interface\\ICONS\\INV_Misc_Fish_57")
xml Code:
<Button name="TestButtonTemplate" virtual="true">
<Layers>
<Layer level="BORDER">
<Texture name="$parentIconTexture" parentKey="icon"/>
</Layer>
</Layers>
</Button>
You can see that I have to use(?) SetAllPoints in order for the texture to show up. What's the reason?
Thanks!