Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-29-18, 06:48 AM   #1
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
[AceConfig] Update options(?) based on selected unit

Hi all ,

I am trying to make an interface options with AceConfig-3.0 and here's what I got so far.

Lua Code:
  1. local anchorList = {TOPLEFT = "TOPLEFT", TOPRIGHT = "TOPRIGHT", BOTTOMRIGHT = "BOTTOMRIGHT", BOTTOMLEFT = "BOTTOMLEFT", LEFT = "LEFT", TOP = "TOP", RIGHT = "RIGHT", BOTTOM = "BOTTOM", CENTER = "CENTER"};
  2.  
  3. local selectedUnit = "Player";
  4.  
  5. local testOption = {
  6.     type = "group",
  7.     childGroups = "tab",
  8.     name = "TestOption",
  9.     args = {
  10.         selected = {
  11.             order = 1,
  12.             type = "select",
  13.             name = "Selected Unit",
  14.             values = {Player = "Player", Pet = "Pet", Target = "Target", TargetTarget = "TargetTarget", Focus = "Focus"},
  15.             get = function(info)
  16.                 return selectedUnit;
  17.             end,
  18.             set = function(info, ...)
  19.                 selectedUnit = ...;
  20.             end,
  21.         },
  22.         general = {
  23.             order = 2,
  24.             type = "group",
  25.             name = "General",
  26.             args = {
  27.                 p = {
  28.                     order = 1,
  29.                     type = "select",
  30.                     name = "Point",
  31.                     values = anchorList,
  32.                 },
  33.                 rT = {
  34.                     order = 2,
  35.                     type = "input",
  36.                     name = "Relative To",
  37.                 },
  38.                 rP = {
  39.                     order = 3,
  40.                     type = "select",
  41.                     name = "Relative Point",
  42.                     values = anchorList,
  43.                 },
  44.                 oX = {
  45.                     order = 4,
  46.                     type = "input",
  47.                     name = "X-Offset",
  48.                 },
  49.                 oY = {
  50.                     order = 5,
  51.                     type = "input",
  52.                     name = "Y-Offset",
  53.                 },
  54.             },
  55.         },
  56.         health = {
  57.             order = 3,
  58.             type = "group",
  59.             name = "Health",
  60.             args = {
  61.                 height = {
  62.                     order = 1,
  63.                     type = "range",
  64.                     name = "Height",
  65.                     min = 4,
  66.                     max = 32,
  67.                     step = 1,
  68.                 },
  69.                 texture = {
  70.                     order = 2,
  71.                     type = "select",
  72.                     name = "Texture",
  73.                     dialogControl = "LSM30_Statusbar",
  74.                     values = AceGUIWidgetLSMlists.statusbar,
  75.                 },
  76.             },
  77.         },
  78.         power = {
  79.             order = 4,
  80.             type = "group",
  81.             name = "Power",
  82.             args = {
  83.                 height = {
  84.                     order = 1,
  85.                     type = "range",
  86.                     name = "Height",
  87.                     min = 4,
  88.                     max = 32,
  89.                     step = 1,
  90.                 },
  91.                 texture = {
  92.                     order = 2,
  93.                     type = "select",
  94.                     name = "Texture",
  95.                     dialogControl = "LSM30_Statusbar",
  96.                     values = AceGUIWidgetLSMlists.statusbar,
  97.                 },
  98.             },
  99.         },
  100.     },
  101. };
  102.  
  103. ACR:RegisterOptionsTable("TestOption", testOption);
  104. ACD:AddToBlizOptions("TestOption", nil, nil);



The question is, is it possible to re-use those General, Health and Power tabs, but only change the db entry based on the selected unit? Or should I re-construct all those tabs whenever the unit changes?

Last edited by Lyak : 09-29-18 at 07:15 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » [AceConfig] Update options(?) based on selected unit


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