Hey,
I try to select in lua a child of a group, but I don't find any way to do this.
Here's my interface :
Here's my code to create this page :
Lua Code:
cwTable = {
name = "Custom Weights",
type = "group",
childGroups = "tree",
args = {
templateName = {
order = 0,
name = "Template Name",
type = "input",
get = function(info, val) end,
set = function(info,val) CreateNewTemplate(val); GearHelper.db.profile.weightTemplate = val end,
},
Select = {
order = 1,
name = "Stats Template",
type = "select",
style = "radio",
values = {
[1] = "Custom Weights",
[0] = "Noxxic Weights"
},
get = function(info, val)
if GearHelper.db.profile.weightTemplate == "NOX" then
return 0
else
return 1
end
end,
set = function(info, val)
local currentSpec = tostring(GetSpecializationInfo(GetSpecialization()))
if val == 1 then
GearHelper.db.profile.weightTemplate = GearHelper.db.profile.lastWeightTemplate
elseif val == 0 then
GearHelper.db.profile.lastWeightTemplate = GearHelper.db.profile.weightTemplate
GearHelper.db.profile.weightTemplate = "NOX"
if not GearHelper.db.profile.CW[currentSpec] then
GearHelper.db.profile.CW[currentSpec] = GearHelper.db.global.templates[currentSpec]["NOX"]
end
end
end,
},
TemplateSelection = {
name = "Template to use",
type = "select",
style = "dropdown",
disabled = function() if GearHelper.db.profile.weightTemplate == "NOX" then return true end end,
get = function(info) return GearHelper.db.profile.weightTemplate end,
set = function(info, val) GearHelper.db.profile.weightTemplate = val end,
values = {}
},
}
}
Each new group is had dynamically by adding a prefab table like this one :
Lua Code:
local newGroup = {
name = val,
value = val,
type = "group",
hidden = function(info) if GearHelper.db.profile.weightTemplate == "NOX" then return true end end,
args = {
Intell = {
order = 1,
name = "Intell",
type = "input",
get = function(info) return GetStatCW(info, "Intellect") end,
set = function(info, val) return SetStatCW(info, val, "Intellect") end,
},
...
}
}
Actually, when I create a new group, the last edited is the one selected. I would like to automatically select the new one when it's created, but I didn't find any one to do this.
Is it even possible without using Ace3 widgets ?
Thanks