my code looks like this: (Ive abbreviated for simplicity.)
local dirtyeditor = false -- At the moment for debugging this is a global but should be a local at the end.
local nameeditbox = AceGUI:Create("EditBox")
nameeditbox:SetCallback("OnTextChanged", function(self) currentSequence = self:GetText(); dirtyeditor = true end)
stepdropdown:SetCallback("OnValueChanged", function (obj,event,key) stepvalue = key; dirtyeditor = true end)
dirtyeditor = false
I added a bunch of print statements and what is occuring is that editframe:Show() is called, dirtyeditor is set to false but then every widget then fires its OnChange event twice (usually in a sequential order but not always the same order). This sets dirtyeditor to true before any user input can occur. Is there an API call I can hit to determine if a widget has changed or another way around this race condition?
Instead of unconditionally setting dirtyeditor to true, compare the current value with what was there before, and set dirtyeditor if they're actually different.
The code didn't show when you needed to know the value of dirtyeditor. So if you need to use it after a user has finished editing a field, you test the values in a different place than if you need to use it *while* the user is editing, etc.