Originally Posted by Fizzlemizz
This would mean you are calling frame:SetBackdropColor(...) on a frame that doesn't the mixin set. Maybe a frame created using CreateFrame() with a template that doesn't set a backdrop by default?
|
The problem goes away if I explicitly inherit from BackdropTemplate. So I'm guessing that
Code:
Mixin(self, BackdropTemplateMixin)
Would fix that. To be clear: the error is thrown in the line
Lua Code:
tempObject = CreateFrame("Frame", objectName, objectParent, "LunarWindow");
So it's not another frame, it's the frame template that I just changed in the XML file.
Originally Posted by Fizzlemizz
Or possibly inheriting a custom xml template that is still using the <Backdrop> </Backdrop> tags and not checking the mixin.
You could
Code:
if not frame.SetBackdropColor then
Mixin(frame, BackdropTemplateMixin)
end
|
Sorry, not following here. This works:
Lua Code:
<OnLoad inherit="prepend">
if BackdropTemplateMixin then
Mixin(self, BackdropTemplateMixin)
end
self:SetBackdropColor(0.2,0.2,0.2,1.0);
</OnLoad>
This does not work (`attempt to call method 'Setbackdrop' (a nil value)` is thrown).
Lua Code:
<OnLoad inherit="prepend">
if BackdropTemplateMixin then
Mixin(self, BackdropTemplateMixin)
end
self:Setbackdrop( {
bgFile = "Interface\\AddOns\\LunarSphere\\art\\Window-Background",
edgeFile = "Interface\\Addons\\LunarSphere\\art\\Window-Border",
tile = true,
tileEdge = false,
tileSize = 128,
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
} )
self:SetBackdropColor(1.0,1.0,1.0,1);
</OnLoad>
Originally Posted by Fizzlemizz
Prikor to the call, but it seems you would be better figuring our where the backdrop is actually set in the first place and fixing that. Setting the colour of a non-existant backdrop doesn't seem very usefull .
|
The backdrop is being set in the XML, as per the original post. With the
Backdrop System Changes it doesn't work anymore.
A question:
According to the backdrop changes page:
Code:
<KeyValue key="backdropInfo" value="BACKDROP_TOOLTIP_16_16_5555" type="global"/>
Where exactly I need to define the backdropInfo value? I've tried creating a frame with
Code:
<Frame name="TestFrame" parent="UIParent" inherits="BackdropTemplate">
<KeyValues>
<KeyValue key="backdropInfo" value="BACKDROP_TOOLTIP_16_16_5555" type="global"/>
<KeyValue key="backdropBorderColor" value="LEGENDARY_ORANGE_COLOR" type="global"/>
<KeyValue key="backdropBorderColorAlpha" value="0.25" type="number"/>
</KeyValues>
<Size x="300" y="300"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Scripts>
<OnLoad inherit="prepend">
print("Loaded!");
</OnLoad>
</Scripts>
</Frame>
And it of course works. Now, if I change the backdropInfo line to
Code:
<KeyValue key="backdropInfo" value="my_backdrop_value" type="global"/>
And define my_backdrop_value in a .lua file:
Lua Code:
my_backdrop_value= {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileEdge = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 },
};
It just doesn't work. Do I need to place it somewhere special?
Thanks!