WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Cannot change menu backdrops beyond level 2 (https://www.wowinterface.com/forums/showthread.php?t=39136)

Kayja 03-02-11 12:10 PM

Cannot change menu backdrops beyond level 2
 
I'm busy fine tweaking my UI and I noticed earlier that menus beyond level 2 were not styled properly with a black backdrop / border and instead were the default WoW style. I checked the coding of the piece that modifys the menu and levels beyond 2 weren't included so I added them, that did not work, no errors or anything but it wouldn't change the backdrop.

So I made a script to test the menus, which was:

/script DropDownList3MenuBackdrop:SetScript("OnShow", function() ChatFrame1:AddMessage("Test") end)

Which of course will print out "Test" into the chat window when I open a menu that is 3 levels deep. This produced an error saying that the DropDownList3MenuBackdrop was a nil value.

So I reloaded the game in case it was like how you cannot have .toc changes happen until you reload the game, maybe I couldn't fiddle until I reloaded after the coding was changed. Loaded back in, same problem.

However... I then tried running that above script in game after I had already accessed a menu beyond level 2 (in this case TinyDPS) and it worked fine... but I cannot seem to do it from LUA, it just won't allow me to change the backdrops of menus 3+ levels deep until after you open a menu system in game past level 2.

Anyone have any ideas? I'm quite stumped.

Akkorian 03-02-11 05:12 PM

Probably, the game doesn’t make the frames until they’re needed. Try finding the function that opens new menu levels, and post-hooking it to change the textures on the frame after it’s created. In PhanxChat we do this to add textures to the temporary chat frames the game creates when you send a conversation to a new window:

Code:

local hook = FCF_OpenTemporaryWindow
FCF_OpenTemporaryWindow = function(...)
        local frame = hook(...)
        -- Do stuff to the frame here.
        return frame
end

There’s probably a similar function related to the dropdown menu system you can hook.

Kayja 03-02-11 06:36 PM

Got it sorted after your advise to look into the function that creates menu levels, and set up a pre-load of the menus for 5 levels deep. Turned out to be so simple in the end I actually feel a bit stupid! Was originally thinking (before you posted) of making a full menu system X levels deep to get the game to load it in, then destroying the menu... thankfully I didn't :p

Thanks again for the assistance!

lua Code:
  1. for i = 1, 5 do
  2.     UIDropDownMenu_CreateFrames(i, i)
  3. end


All times are GMT -6. The time now is 03:55 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI