GameTooltip:GetBackdrop() a nil value for Shadowlands 90105
Hi there! I'm a little baffled by the following line working on Classic, BCc and Restila (up to 90100), but throwing an exception in Retail 90105:
Lua Code:
I get the following exception: Code:
Interface\AddOns\LunarSphere\lib\moduleButton.lua:223: attempt to call method 'GetBackdrop' (a nil value) I've tried using this: Lua Code:
But then I get an error: Code:
function arguments expected near 'then' I'm not the original author of the addon, so I'm not sure what was their intention calling Code:
GameTooltip:GetBackdrop() Code:
my_widget:GetBackdrop() Thanks!! |
Code:
if not GameTooltip:GetBackdrop then Code:
if not GameTooltip.GetBackdrop then |
Thanks for the suggestion!
Indeed, the code below works: Lua Code:
The Mixin call doesn't really fix the problem, because now I don't get an error for calling a function the doesn't exist (attempt to call method 'GetBackdrop' (a nil value)), but GetBackdrop returns nil on the Retail client (works fine on BCC and Classic) What I'm curious now is: 1. My understanding is that GameTooltip is a global object created by the API itself. Is this correct? 2. What is the proper fix for my original problem (attempt to call method 'GetBackdrop' (a nil value)), or the second (GetBackdrop returning nil after the Mixin call)? 3. This used to work on 90100. Why is it broken now? 4. The double-colon syntax denotes a class, while the period denotes an object, right (I come from C++)? My understanding is that in Lua they're the same thing as Lua is prototype-based. Why do I have to use a different syntax in the test and in the call? Thanks!!! |
Code:
GameTooltip.NineSlice:GetBackdrop() There is a GameToolTip widget type (like a Frame or a Button widget type) and there is the "GameToolTip" frame (a GameToolTip widget that has been given the name "GameToolTip") that inherits "SharedTooltipTemplate" which has a sub-frame that inherits the "NineSlicePanelTemplate". This is new to 9.1.5. |
Thanks for the answer. I'm still not sure that the line
Lua Code:
Is supposed to do. Pardon my ignorance, what's the difference between that call above and Lua Code:
? |
As I believe it's mentioned elsewhere, frames are just special types of tables so:
GameTooltip.GetBackdrop is the same as GameTooltip["GetBackdrop"] ie. test the existance/value of the GetBackdrop key in the GameTooltip table (in this case it's a function (method)) GameTooltip:GetBackdrop() runs the function but unlike using GameTooltip.GetBackdrop(), automatically passes the table (or in this case frame) as the first parameter (self). |
So how can we hide the backdrop of a tooltip now? I used to do:
Lua Code:
|
Ah!
Lua Code:
|
Thanks very much for your answers.
Quote:
Quote:
So, back to my original question. Before 9.1.5, the line Lua Code:
Would get the backdrop (the default one I presume) from the GameToolTip widget type. Now, it's trying to get the backdrop from the "GameToolTip frame", which doesn't have that method (that would make sense of the `attempt to call method 'GetBackdrop' (a nil value)` error)? If that changed, what's the new equivalent way to get the backdrop? Thanks very much! |
In 9x frames no longer had a the backdrop system automatically applied to all of them, you had to manually add it to frames that needed a backdrop so Blizz added the system to the GameTooltip.
In 9.1.5 the layout of the GameTooltip frame changed so they can have funkier tooltips. With this change, the backdrop was moved from being applied to the top level frame (GameTooltip) to the NineSlice sub-frame so: Code:
GameTooltip:GetBackdrop() Code:
GameTooltip.NineSlice:GetBackdrop() |
All times are GMT -6. The time now is 11:36 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI