Thread Tools Display Modes
12-19-19, 07:48 PM   #1
Niketa
A Wyrmkin Dreamwalker
 
Niketa's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2013
Posts: 54
Help with Ace3 options table

I'm trying to figure out how to update an open Ace3 options panel on demand. If I open my panel, I can change my db values with the interface, but when I change the values somewhere else the interface doesn't update to reflect the new value.

For example, I have a toggle button that shows the "movable" value of a bar. It works just fine in the interface. However, I can also change this value by shift+clicking on my bar frame (completely separate frame than the options frame). But, if I have the options frame open when I do this, the toggle will display the old value and doesn't update unless I reopen the frame.

I tried to use AceConfigRegistry's NotifyChange, but it doesn't seem to be doing what I expect.

Here's an example of a function that I use to set a value outside of the interface:
Code:
function addon:SetDBValue(dbType, info, value, ...)
    info = type(info) == "table" and info[#info] or info
    local db = self:GetDB(dbType, ...)
    if not db then return end
    db[info] = value

    LibStub("AceConfigRegistry-3.0"):NotifyChange(addonName)
end
addonName is the same variable used for RegisterOptions.

This doesn't exactly cause an error or anything, it just doesn't update the interface. I'm not sure if maybe there's another function that I can't seem to find that can refresh the frame. Or perhaps there's another step I need to use NotifyChange?

I saw where someone said to use AceConfigDialog.OpenFrames["AppName"] to see if a frame is open, but the OpenFrames table is empty, even when I have my panel open. If this could work, I could just check if it's open, close it, then reopen it. But I feel like this would be overkill and there must be a simpler solution.

This returns an empty table, even when my options are open:
Code:
/dump LibStub("AceConfigDialog-3.0").OpenFrames
I'm not sure what other relevant code I need to share, so I apologize if I'm missing something.

Also, I just realized I may have posted this in the wrong forum. If a mod could move it, that would be cool. Or if it's ok, then no worries.

Last edited by Niketa : 12-19-19 at 07:54 PM.
  Reply With Quote
12-20-19, 10:37 AM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
I originally wrote LibOptionsAssist to give me the ability to refresh my options. You can use it or look at the code to see how it works and apply it to your situation. Keep in mind I didn't know about NotifyChange at the time so I never tried to get that to work.
  Reply With Quote
12-29-19, 09:35 AM   #3
Niketa
A Wyrmkin Dreamwalker
 
Niketa's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2013
Posts: 54
I found out what my problem was using the OpenFrames table. I was Opening my options into a container frame that I created, which I didn't need to use. So when I removed that frame and just opened it without the second parameter, my frame showed up in that table.

Final result was to simply check if the frame was open and if it was, call Open again to refresh it.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Help with Ace3 options table

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