Quantcast
WoWInterface - View Single Post - Dynamic Button Layouts
View Single Post
06-22-21, 08:04 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,439
Possibly something like this so you can store references to your created buttons into ButtonTable

Lua Code:
  1. local ButtonTable = {
  2.     LogoutButton = { active=true },
  3.     ExitButton = { active=true },
  4.     FStackButton = { active=true },
  5.     ClearChatButton = { active=true },
  6.     ChatSpacerButton = { active=true },
  7.     ETraceButton = { active=true },
  8.     ETraceStartButton = { active=true },
  9.     ETraceStopButton = { active=true },
  10.     ChatLogButton = { active=true },
  11.     CombatLogButton = { active=true }
  12. }
  13.  
  14. for k, v in pairs(ButtonTable) do
  15.     if active then
  16.         local f = CreateFrame("Button", "WhateverTheNameIs", UIParent, "UIPanelButtonTemplate")
  17.         v.button = f -- store the reference to the new button into ButtonTable
  18.         -- rest of the button creation
  19.     end
  20. end
  21.  
  22. local function buttonFrameButtonLayout()
  23.     for k, v in pairs(ButtonTable) do
  24.         if v.active then
  25.             thisButton = v.button --retrieve the reference to the button from ButtonTable
  26.             thisButton:ClearAllPoints()
  27.             -- ...
  28.         end
  29.     end
  30. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote