WoWInterface - View Single Post - Ace3: Profile reset does not refresh config dialog?
View Single Post
03-06-20, 07:00 AM   #1
A Warpwood Thunder Caller
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 99
Ace3: Profile reset does not refresh config dialog?


I wonder how I can refresh the ace config dialog after I perform a profile reset (using Ace3).

Lua Code:
  1. function MyUI:SetupOptions()
  2.     MyUI.options = {
  3.         type = "group",
  4.         name = "My UI",
  5.         args = {};
  6.     };
  7.     MyUI.options.args.profile = DB_OPTIONS:GetOptionsTable(MyUI.db);
  8.     MyUI.options.args.profile.order = -10;
  9.     MyUI.options.args.profile.args.reset.confirm = true;
  11.     CONFIG:RegisterOptionsTable(MyUI.ADDON_NAME, MyUI.options);
  12.     CONFIG:RegisterOptionsTable(MyUI.ADDON_NAME .. "_Profile", MyUI.options.args.profile);
  14.     CONFIG_DIALOG:AddToBlizOptions(MyUI.ADDON_NAME, "My UI");
  15.     CONFIG_DIALOG:SetDefaultSize(MyUI.ADDON_NAME, MyUI:DefaultConfigSize());
  16. end

Lua Code:
  1. function MyUI:OnInitialize()
  2.     self.db = DB:New("MyDB", defaults, true);
  3.     self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig");
  4.     self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig");
  5.     self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig");
  6. end
  8. function MyUI:RefreshConfig()
  9.     -- This calls every sub module to refresh it's state
  10.     self:OnUpdate();
  11. end

When I press the "Reset Profile" button all my settings are getting reset but the ace config dialog which is currently open and where I pressed the reset profile button in is not updating to the new state. I need to reload the UI to get the config dialog to show the new state. But that is not all, the options are also all broken. Those settings which got reset cant get configured by ace config dialog anymore until I reloaded the UI. Nothing happens when I use them without reloading the UI.

I tried using:

Lua Code:
  1. function MyUI:RefreshConfig()
  2.     -- This calls every sub module to refresh it's state
  3.     self:OnUpdate();
  6. end

But it has no effect. I would expect that the config dialog refreshes automatically after I reset the profile through ace3 internal functions. Is there any way I can refresh the config dialog without reloading the UI?

Last edited by Lybrial : 03-06-20 at 07:03 AM.
  Reply With Quote