Go to Page... |
|
Thread Tools | Display Modes |
|
05-24-21, 08:42 PM | #1 |
Problem using a custom backdrop with the new backdrop system changes
Hi there! I'm having a hard time understanding how to translate the old <Backdrop> tags to the new system.
I'm creating the following frame in XML: 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> Lua Code:
I've added that to a .lua file that's listed in the ToC file, and changed my frame to: Code:
<Frame name="TestFrame" parent="UIParent" inherits="BackdropTemplate"> <KeyValues> <KeyValue key="backdropInfo" value="BACKDROP_TOOLTIP_MYBACKDROP" 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> Do I need to place BACKDROP_TOOLTIP_MYBACKDROP somewhere special? I've also tried to use: Code:
<Frame name="TestFrame" parent="UIParent"> <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"> if BackdropTemplateMixin then -- if this is NOT a Classic type frame, add the backdrop mixin Mixin(self, BackdropTemplateMixin) end self:Setbackdrop( { 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 } }) print("Loaded!"); </OnLoad> </Scripts> </Frame> Code:
Message: [string "TestFrame:OnLoad"]:4: attempt to call method 'Setbackdrop' (a nil value) Time: Mon May 24 22:39:22 2021 Count: 1 Stack: [string "TestFrame:OnLoad"]:4: attempt to call method 'Setbackdrop' (a nil value) [string "*:OnLoad"]:4: in function <[string "*:OnLoad"]:1> |
|
05-24-21, 09:32 PM | #2 |
First decision. Do you want to make seperate xml frames for classic and non-classic
If yes then: Classic: (same as always) Lua Code:
Lua Code:
Or, do you want one frame for both Classic and the rest: Mostly the same xml frame but detecting if backdrop mixin (template) is needed and all backdrop information is set in lua (OnLoad) Lua Code:
Definitions like BACKDROP_TOOLTIP_16_16_5555 and LEGENDARY_ORANGE_COLOR don't exist in Classic and may not BCC either so probably easiest not to use them and just define backdrop, colours, alpha manually in both.
__________________
Fizzlemizz Maintainer of Discord Unit Frames and Discord Art. Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus. Last edited by Fizzlemizz : 05-24-21 at 09:42 PM. |
|
WoWInterface » Developer Discussions » Lua/XML Help » Problem using a custom backdrop with the new backdrop system changes |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|