WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   InterfaceOptionsFrame_OpenToCategory() (https://www.wowinterface.com/forums/showthread.php?t=54599)

ruadh 10-03-16 10:29 PM

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.

Phanx 10-03-16 11:02 PM

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.)

ruadh 10-04-16 08:46 AM

Okay, thanks. I knew I'd seen it before, but figured someone else was making the same mistake I was. Thanks for the explanation.


All times are GMT -6. The time now is 06:53 PM.

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