Quantcast
Defaults "These Settings" handle - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-29-16, 06:07 PM   #1
Benio
A Murloc Raider
Join Date: Jul 2016
Posts: 8
Defaults "These Settings" handle

Hey, I made an addon that uses Ace3:
It stores options, adds it to Blizzard Addon options page, saves beetween sessions etc.
However, when I click Interface → Options → AddOns → Defaults → These Settings, nothing happens.

Lua Code:
  1. -- libs
  2. -- external /libs as ADDON_NAME.libs objects
  3. ADDON_NAME.libs = {};
  4. ADDON_NAME.libs.Config = LibStub("AceConfig-3.0");
  5. ADDON_NAME.libs.ConfigDialog = LibStub("AceConfigDialog-3.0");
  6. ADDON_NAME.libs.DB = LibStub("AceDB-3.0");
  7. ADDON_NAME.libs.Timer = LibStub("AceTimer-3.0");
Lua Code:
  1. -- options
  2. -- ADDON_NAME.default.global.MODULE_NAME
  3. -- ADDON_NAME.options.args.MODULE_NAME
  4. ADDON_NAME.default = {global = {}};
  5. ADDON_NAME.options = {
  6.     name = "ADDON_FULL_NAME",
  7.     type = "group",
  8.     args = {},
  9. };
Lua Code:
  1. ADDON_NAME.db = ADDON_NAME.libs.DB:New("ADDON_NAMEDB", ADDON_NAME.default, true);
  2. ADDON_NAME.libs.Config:RegisterOptionsTable("ADDON_NAME", ADDON_NAME.options);
  3. ADDON_NAME.frames = {options = ADDON_NAME.libs.ConfigDialog:AddToBlizOptions("ADDON_NAME")};

I tried to implement it according to some comments I saw, using:
Lua Code:
  1. ADDON_NAME.libs.ConfigRegistry = LibStub("AceConfigRegistry-3.0");
Lua Code:
  1. ADDON_NAME.frames.options.default = function(...)
  2.     ADDON_NAME.db = ADDON_NAME.default;
  3.     ADDON_NAME.libs.ConfigRegistry:NotifyChange("ADDON_NAME");
  4. end;

It changes ADDON_NAME.db, and corresponding GUI in options panel at will.
However, it works only first time after (re)loading GUI and changes are not saved.

Problem: How to handle Defaults → "These Settings" to default it's settings and save them correctly?
Any manual page, tutorial, examples or direct solution would be appreciated.

Last edited by Benio : 07-29-16 at 08:36 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Defaults "These Settings" handle

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