WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Ace3 Select child from group (https://www.wowinterface.com/forums/showthread.php?t=56018)

Marsgames 02-05-18 09:34 AM

Ace3 Select child from group
 
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:
  1. cwTable = {
  2.     name = "Custom Weights",
  3.     type = "group",
  4.     childGroups = "tree",
  5.     args  = {
  6.         templateName = {
  7.             order =  0,
  8.             name = "Template Name",
  9.             type = "input",
  10.             get = function(info, val)  end,
  11.             set = function(info,val) CreateNewTemplate(val); GearHelper.db.profile.weightTemplate = val end,
  12.         },
  13.         Select = {
  14.             order = 1,
  15.             name = "Stats Template",
  16.             type = "select",
  17.             style = "radio",
  18.             values = {
  19.                 [1] = "Custom Weights",
  20.                 [0] = "Noxxic Weights"
  21.             },
  22.             get = function(info, val)
  23.                 if GearHelper.db.profile.weightTemplate == "NOX" then
  24.                     return 0
  25.                 else
  26.                     return 1
  27.                 end
  28.             end,
  29.             set = function(info, val)
  30.                 local currentSpec = tostring(GetSpecializationInfo(GetSpecialization()))
  31.  
  32.                 if val == 1 then
  33.                     GearHelper.db.profile.weightTemplate = GearHelper.db.profile.lastWeightTemplate
  34.                 elseif val == 0 then
  35.                     GearHelper.db.profile.lastWeightTemplate = GearHelper.db.profile.weightTemplate
  36.                     GearHelper.db.profile.weightTemplate = "NOX"
  37.                     if not GearHelper.db.profile.CW[currentSpec] then
  38.                         GearHelper.db.profile.CW[currentSpec] = GearHelper.db.global.templates[currentSpec]["NOX"]
  39.                     end
  40.                 end
  41.             end,
  42.         },
  43.         TemplateSelection = {
  44.             name = "Template to use",
  45.             type = "select",
  46.             style = "dropdown",
  47.             disabled = function() if GearHelper.db.profile.weightTemplate == "NOX" then return true end end,
  48.             get = function(info) return GearHelper.db.profile.weightTemplate end,
  49.             set = function(info, val) GearHelper.db.profile.weightTemplate = val end,
  50.             values = {}
  51.         },
  52.     }
  53. }

Each new group is had dynamically by adding a prefab table like this one :
Lua Code:
  1. local newGroup  = {
  2.         name = val,
  3.         value = val,
  4.         type = "group",
  5.         hidden = function(info) if GearHelper.db.profile.weightTemplate == "NOX" then return true end end,
  6.         args =  {
  7.             Intell = {
  8.                 order = 1,
  9.                 name = "Intell",
  10.                 type = "input",
  11.                 get = function(info) return GetStatCW(info, "Intellect") end,
  12.                 set = function(info, val) return SetStatCW(info, val, "Intellect") end,
  13.             },
  14.             ...
  15.         }
  16. }


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

Marsgames 02-06-18 04:04 PM

I found what I wanted with the function LibStub("AceConfigDialog-3.0"):SelectGroup()


All times are GMT -6. The time now is 07:06 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI