Quantcast InterfaceOptionsFrame_OpenToCategory() - WoWInterface
Thread Tools Display Modes
10-03-16, 10:29 PM   #1
ruadh
A Murloc Raider
Join Date: Aug 2007
Posts: 5
InterfaceOptionsFrame_OpenToCategory()

With the help of some folks here I got my configuration frame to load into the Bliz InterfaceOptionsFrame, and I've got the various widgets setting the right options and so forth.

I added a slash command to open the config frame and it doesn't seem to be working as expected.

Lua Code:
  1. function ADDON.cmd._CONFIG:use()
  2.     if _DEBUG then ADDON.dbug("Config frame: %1", ADDON.frame.name); end
  3.     InterfaceOptionsFrame_OpenToCategory(ADDON.frame);
  4. end

Seems simple enough. The debug statement confirms that ADDON.frame is what I think it is, and the InterfaceOptionsFrame appears. But the first time it opens it shows the Controls category in the Game tab. The second and all subsequent times that I use the slash command it opens to my addon cateory (no matter where it was when I closed it). It doesn't matter whether the options frame was first opened with the slash command or the game menu, if it's been opened once the slash command works. If it hasn't been opened, it always goes to the Controls category.

Has anyone else had this behavior? Is there a solution? Thanks.
  Reply With Quote
10-03-16, 11:02 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That's a known issue, and has been a known issue since InterfaceOptionsFrame_OpenToCategory was first introduced. Since it's been years and would take someone 2 minutes to fix, we can only assume Blizzard just doesn't care and won't ever fix it.

The standard workaround you can use in your addon is just to call InterfaceOptionsFrame_OpenToCategory twice in a row. This will "fix" the problem in most cases.

The one case where this workaround won't "fix" the problem is if you (or your addon's user) have so many addons running that the list of options panels on the left is longer than the window height (ie. there's a scroll bar) and your addon's panel is currently off-screen (ie. you would have to scroll to get to it). Most people don't use enough addons for this to be an issue, but if you do, you can install BlizzBugsSuck to get a more comprehensive fix that doesn't depend on any code in your addon (and also fixes for some other long-standing Blizzard bugs). (However, you should not copy/paste this fix into your own addon -- for one, fixing Blizzard bugs isn't the purpose of your addon, and it's bad practice to put stuff into your addon that's not related to its acutal purpose; for two, and more importantly in practice, there's no way for you to tell if another addon is already doing the same thing, and if multiple addons are doing the same thing, they'll very likely cause an infinite loop and require Alt-F4ing out of the game client.)
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
10-04-16, 08:46 AM   #3
ruadh
A Murloc Raider
Join Date: Aug 2007
Posts: 5
Okay, thanks. I knew I'd seen it before, but figured someone else was making the same mistake I was. Thanks for the explanation.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » InterfaceOptionsFrame_OpenToCategory()

Thread Tools
Display Modes

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