View Single Post
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