AceConfig-3.0 Options: Inherit "disabled" from parent group explicitly? - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-29-20, 08:47 AM   #1
A Frostmaul Preserver
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 283
AceConfig-3.0 Options: Inherit "disabled" from parent group explicitly?

I want to make a "reset to default" button next to every slider in my settings.
To safe code lines and make it more maintainable, I have a function to create this reset button:

Lua Code:
  1. local function CreateSliderResetButton(order, forSituations, index1, index2)
  2.   return {
  3.     type = "execute",
  4.     name = "Reset",
  5.     order = order,
  6.       func =
  7.         function()
  8.           DynamicCam:SetSettingsDefault(forSituations, index1, index2)
  9.         end,
  10.       disabled =
  11.         function()
  12.           return DynamicCam:GetSettingsValue(forSituations, index1, index2) == DynamicCam:GetSettingsDefault(index1, index2)
  13.       end,
  14.   }
  15. end

So the button gets disabled, whenever the slider already has the default value.
But the button should also get disabled, whenever the button's parent group is disabled, as it is the case when the button does not have a "disabled" function of its own.

Is there a way to explicitly check for the parent group's disable status?
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AceConfig-3.0 Options: Inherit "disabled" from parent group explicitly?

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