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:
local function CreateSliderResetButton(order, forSituations, index1, index2)
return {
type = "execute",
name = "Reset",
order = order,
func =
function()
DynamicCam:SetSettingsDefault(forSituations, index1, index2)
end,
disabled =
function()
return DynamicCam:GetSettingsValue(forSituations, index1, index2) == DynamicCam:GetSettingsDefault(index1, index2)
end,
}
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?