All my frames are transparent in Retail/BCC
I'm updating an addon to BCC and I managed to make it work with the Backdrop System Changes by inheriting from `BackdropTemplate`. But now all my frame are transparent, they have no background.
I'm creating the frames like so: Lua Code:
The `LunarWindow` template is defined as Code:
<Frame name="LunarWindow" movable="true" toplevel="true" enableMouse="true" hidden="true" parent="UIParent" virtual="true" inherits="BackdropTemplate"> https://imgur.com/pWBjlG3 But for the Classic client it works! The Classic `LunarWindow` template just differs by not inheriting from `BackdropTemplate`: Code:
<Frame name="LunarWindow" movable="true" toplevel="true" enableMouse="true" hidden="true" parent="UIParent" virtual="true"> https://imgur.com/yuiNdm8 What am I doing wrong here? Do I need to inherit from something different than `BackdropTemplate`? Thanks!! |
Will allow you use the same xml frame in either Classic (era) or BCC or Retail by using the OnLoad script to check is the mixin exists or not.
If the mixin doesn't exist then frames automatically have a Backdrop. You would also move the <Backdrop...> </Backdrop> into a SetBackdrop call in the OnLoad function after checking for the mixin. The new xml would look something like (no backdrop inherited): Code:
<Frame name="LunarWindow" movable="true" toplevel="true" enableMouse="true" hidden="true" parent="UIParent" virtual="true"> Code:
function OnLoadFunc(self) |
Thanks for the reply!
I've tried your suggestion and now I'm getting an `attempt to call method 'SetBackdropColor' (a nil value)` error when trying to create the frame. Where should the `OnLoadFunc` function be placed? Does it need to be somewhere special? But regardless of that, my understanding is that by using an `OnLoad` method you can avoid having separate XML files for Classic and Retail/BCC, which is nice. Will this solve the problem of transparent backgrounds? The frame already had a <Script> section: Code:
<Scripts> Code:
<Scripts> Thanks! |
Quote:
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 |
Code:
<Scripts> Lua Code:
Lua Code:
|
Quote:
Code:
Mixin(self, BackdropTemplateMixin) Lua Code:
So it's not another frame, it's the frame template that I just changed in the XML file. Quote:
Lua Code:
This does not work (`attempt to call method 'Setbackdrop' (a nil value)` is thrown). Lua Code:
Quote:
A question: According to the backdrop changes page: Code:
<KeyValue key="backdropInfo" value="BACKDROP_TOOLTIP_16_16_5555" type="global"/> Code:
<Frame name="TestFrame" parent="UIParent" inherits="BackdropTemplate"> Code:
<KeyValue key="backdropInfo" value="my_backdrop_value" type="global"/> Lua Code:
It just doesn't work. Do I need to place it somewhere special? Thanks! |
Lua Code:
Because the frame doesn't have the backdrop code when it is created, the xml attributes for backdrops are ignored (or error?) so they have to be set after the frame is configured to use a backdrop via the mixin. This should work in all versions of the client. You could replace: Code:
self:SetBackdrop( BACKDROP_TOOLTIP_16_16_5555 ) Code:
self:SetBackdrop( |
All times are GMT -6. The time now is 10:20 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI