WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Hook to resize the CollectionsJournal frame (https://www.wowinterface.com/forums/showthread.php?t=59700)

Tair 10-28-23 09:38 AM

Hook to resize the CollectionsJournal frame
 
I am working on a simple addon to resize certain Blizzard frames to compensate for ElvUI's low recommended UI scale on my monitor.

I have found that certain frames need to be resized at the time of their opening, otherwise the frame appears to be inaccessible or otherwise resets its scale. The backpack, as an example:
Code:

hooksecurefunc("OpenBackpack", function()
        ContainerFrameCombinedBags:SetScale(scale)
end)

However, I am stuck on trying to set the scale of the collections journal using a similar approach:

Code:

hooksecurefunc("CollectionsJournal_OnShow", function()
        CollectionsJournal:SetScale(scale)
end)

This returns an error: hooksecurefunc(): CollectionsJournal_OnShow is not a function

I've confirmed that the function exists in Blizzard_Collections.lua, but I'm wondering if it's maybe inaccessible.

Any tips would be greatly appreciated. Thank you for reading.

Fizzlemizz 10-28-23 10:17 AM

The Blizzard_Collections is marked as LoadOnDemand (see the Blizzard_Collections.toc file) which means it's not loaded along with the core UI before 3rd party addons (usually loads in response to the player pressing a key or clicking a button).

Your addon will need to listen for the ADDON_LOADED event and check if "Blizzard_Collections" is the addon and if so, then set up your hooks.

Tair 10-28-23 10:44 AM

Thank you very much, Fizzlemizz. You taught me something new and helped me solve my problem. I appreciate your help and insight!


All times are GMT -6. The time now is 07:20 AM.

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