Thread Tools Display Modes
10-27-22, 04:42 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
InterfaceOptionsFrame_OpenToCategory not working

Hi all

I am having trouble with InterfaceOptionsFrame_OpenToCategory

I have checked the updated InterfaceOptionsFrame.lua and found the open to category function at line 419

I have not been able to get it working at all.

Here is my frame;
Lua Code:
  1. local NewbDevBoxInterfaceFrame = CreateFrame("Frame", "NewbDevBoxInterfaceFrame", UIParent, "BackdropTemplate")
  2. NewbDevBoxInterfaceFrame.name = "Newb Dev Box"
  3. NewbDevBoxInterfaceFrame:SetBackdrop(
  4.     {
  5.         bgFile = "Interface\\Buttons\\WHITE8X8",
  6.         insets = {
  7.             left = NumberList.insetSize,
  8.             right = NumberList.insetSize,
  9.             top = NumberList.insetSize,
  10.             bottom = NumberList.insetSize
  11.         },
  12.         tileSize = nil,
  13.         tile = false,
  14.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  15.         edgeSize = NumberList.edgeSize
  16.     }
  17. )
  18. NewbDevBoxInterfaceFrame:SetBackdropColor(unpack(TextDimensionList.colourBackdrop))
  19. NewbDevBoxInterfaceFrame:SetBackdropBorderColor(unpack(TextDimensionList.colourBorder))
  20. NewbDevBoxInterfaceFrame:SetScript(
  21.     "OnEvent",
  22.     function(self, event, ...)
  23.         if event == "PLAYER_LOGIN" then -- fires when a player logs in or reloads
  24.             print(TextStringList.addonLoaded) -- Load Message
  25.             initialiseLists()
  26.             setUpNewbDevBoxSortedTable()
  27.             checkOtherAddonsEnabled()
  28.             setCheckBoxesAndButtonFrameMetrics()
  29.             buttonFrameButtonLayout()
  30.         end
  31.     end
  32. )
  33. NewbDevBoxInterfaceFrame:RegisterEvent("PLAYER_LOGIN") -- fires when a player logs in or reloads
  34. NewbDevBoxInterfaceFrame:RegisterEvent("ADDON_LOADED") -- fires when an addon is loaded
  35. InterfaceOptions_AddCategory(NewbDevBoxInterfaceFrame)
My function;
Lua Code:
  1. function NEWBDEVBOXTOGGLENEWBDEVBOXINTERFACEFRAME()
  2.     if InterfaceOptionsFrame:IsShown() then
  3.         InterfaceOptionsFrame:Hide()
  4.     else
  5.         InterfaceOptionsFrame_OpenToCategory(NewbDevBoxInterfaceFrame) -- have to do this twice because reasons
  6.         InterfaceOptionsFrame_OpenToCategory(NewbDevBoxInterfaceFrame)
  7.     end
  8. end
And the error;
Lua Code:
  1. 1x Interface/AddOns/NewbDevBox/NewbDevBox.lua:441: attempt to index global 'InterfaceOptionsFrame' (a nil value)
  2.         [string "@Interface/AddOns/NewbDevBox/NewbDevBox.lua"]:441: in function `NEWBDEVBOXTOGGLENEWBDEVBOXINTERFACEFRAME'
  3.        [string "@Interface/AddOns/NewbDevBox/NewbDevBox.lua"]:1382: in function <Interface/AddOns/NewbDevBox/NewbDevBox.lua:1381>
  4.        
  5.        Locals:
  6.        (*temporary) = nil
  7.        (*temporary) = nil
  8.        (*temporary) = "attempt to index global 'InterfaceOptionsFrame' (a nil value)"
  9.        
  10.  
  11.  
  12.  
  13.        (NewbDevBoxInterfaceFrame)
As you can see the error says that the frame does not exist, yet when I navigate to the addons list I can see and use the category frame without a problem or an error.

I guess something changed with the pre-patch yet I cannot figure out a reason that InterfaceOptionsFrame_OpenToCategory no longer works for me.

Looking for some help with this one.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
10-27-22, 05:00 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
https://github.com/Stanzilla/WoWUIBugs/issues/

See the last issue.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-27-22, 06:14 PM   #3
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Ah, I see, this is a common issue that has been raised, and now we await a change by Blizz.

At least this wasn't an error of mine.

Thanks for letting me know.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
10-28-22, 03:50 PM   #4
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Just a followup question.

The link you gave me takes me to "Stanzilla / WoWUIBugs"

How do these issues make it to Blizz?
Is Stanzilla a Blizz employee or just a member of the community that has a pipeline directly to Blizz?

I am still a newb and I don't even understand how to use Git and why it is so important for coding.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
10-28-22, 04:51 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Stan is not an employee. These are people that have had long ties with Blizz. UI devs. and are still interested/trusted enough to maintain the link between authors and Blizz. by making sure they don't get overloaded with trivial reports.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
10-29-22, 05:13 AM   #6
Cerelius
A Defias Bandit
Join Date: Oct 2022
Posts: 2
Sorry, I'm very new to this, so maybe this was already answered. I can see in retail now InterfaceOptionsFrame.lua is gone completely and threre's no InterfaceOptionsFrameCancel_OnClick() fucntion anymore. Was it replaced with something else?

Also regarding this:

https://github.com/Stanzilla/WoWUIBugs/issues/

What is the issue there that is relevant to this thread?

Thanks in advance!
  Reply With Quote
10-29-22, 08:19 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
The issue has moved to the second page.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
11-03-22, 06:23 PM   #8
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Just following this issue up.

There are at least three addons, MinimalArcheology and KalielsTracker, that still open directly to their respective settings in the options frame.

I have almost gone blind trying to find the way they have managed to sidestep the InterfaceOptionsFrame_OpenToCategory call but so far have not been able to see their method.

I note that both of these addons are using libs but I do not understand how libs work, (to be honest I have no real understanding of what libs really are).

I found in MinimalArcheology they still use the InterfaceOptionsFrame_OpenToCategory call, MinimalArchaeology\addon\components line 49, and it still seems to work.

I have not been able to find the method that KaliesTracker uses.

My questions are, why does the InterfaceOptionsFrame_OpenToCategory call still work in MinimalArcheology?

And, how do I find what KaliesTracker uses to still open to category functionality?
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
11-04-22, 06:11 AM   #9
Cerelius
A Defias Bandit
Join Date: Oct 2022
Posts: 2
Good catch! I checked KalielsTracker and basically they use HideUIPanel(SettingsPanel) to close options window and then just open whatever window they need. This fixed my problem too.
  Reply With Quote
11-06-22, 04:09 PM   #10
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Thanks, Cerelius, your post led me to the answer.
Lua Code:
  1. function NEWBDEVBOXTOGGLENEWBDEVBOXINTERFACEFRAME()
  2.     if SettingsPanel:IsShown() then
  3.         HideUIPanel(SettingsPanel)
  4.     else
  5.         HideUIPanel(SettingsPanel)
  6.         InterfaceOptionsFrame_OpenToCategory(NewbDevBoxInterfaceFrame)
  7.     end
  8. end
The added bonus is that I only had to call InterfaceOptionsFrame_OpenToCategory once.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
11-07-22, 02:53 AM   #11
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
As InterfaceOptionsFrame_OpenToCategory is marked as deprecated ( here ), I use this in my addons :

1 - Settings panel creation:
Lua Code:
  1. local panel = CreateFrame("Frame", MyAddonSettingsPanelName)
  2. ... populate and customize frame here
  3.  
  4. if (Settings ~= nil) then
  5.     -- wow10
  6.     local category = Settings.RegisterCanvasLayoutCategory(panel, MyAddonName)
  7.     Settings.RegisterAddOnCategory(category)
  8.     panel.categoryID = category:GetID() -- for OpenToCategory use
  9. else
  10.     -- wow classic
  11.     panel.name = MyAddonName
  12.     -- panel.okay = ...
  13.     -- panel.cancel = ...
  14.     -- panel.default = ...
  15.     -- panel.refresh = ...
  16.     InterfaceOptions_AddCategory(panel)
  17. end

2 - Settings opening:
Lua Code:
  1. if (Settings ~= nil) then
  2.     -- wow10
  3.     local settingsCategoryID = _G[MyAddonSettingsPanelName].categoryID
  4.     Settings.OpenToCategory(settingsCategoryID)
  5. else
  6.     -- wow classic
  7.     InterfaceAddOnsList_Update()
  8.     InterfaceOptionsFrame_OpenToCategory(addonName)
  9. end

It works, but maybe it could be optimized.
__________________
Zax - Addons List, not all maintained.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » InterfaceOptionsFrame_OpenToCategory not working


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off