View Single Post
06-23-21, 01:54 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
It looks like you're wanting something like the following to create a set of columns/rows:

Lua Code:
  1. local function buttonFrameButtonLayout()
  2.     local lastRelative, lastOnTop = NewbDevBoxButtonFrameReloadButton, NewbDevBoxButtonFrameReloadButton
  3.     local lastCount = 1
  4.     for k, v in pairs(NewbDevBoxDisplayButtonTable) do
  5.         if v then
  6.             thisButton = _G["NewbDevBoxButtonFrame" .. k]
  7.             thisButton:ClearAllPoints()
  8.             if mod(lastCount, 3) == 0 then
  9.                 thisButton:SetPoint("LEFT", lastOnTop, "RIGHT", 10, 0)
  10.                     lastOnTop = thisButton
  11.             else
  12.                 thisButton:SetPoint("TOP", lastRelative, "BOTTOM", 0, -5)
  13.             end
  14.             lastCount = lastCount + 1
  15.             lastRelative = thisButton
  16. --[[
  17.             thisButton:SetPoint(
  18.                 VariableList.currentParentAnchorPoint,
  19.                 VariableList.currentAnchorButton,
  20.                 VariableList.currentChildAnchorPoint,
  21.                 VariableList.currentSideGap,
  22.                 VariableList.currentYGap
  23.             )
  24.  
  25.             if VariableList.currentButtonCount == 3 then
  26.                 VariableList.currentParentAnchorPoint = "LEFT"
  27.                 VariableList.currentAnchorButton = VariableList.topAnchorButton
  28.                 VariableList.currentChildAnchorPoint = "RIGHT"
  29.                 VariableList.currentSideGap = NumberList.actionButtonSideGap
  30.                 VariableList.currentYGap = 0
  31.                 VariableList.currentButtonCount = 1
  32.             elseif VariableList.currentButtonCount == 1 then
  33.                 VariableList.currentParentAnchorPoint = "BOTTOM"
  34.                 VariableList.currentAnchorButton = thisButton
  35.                 VariableList.currentChildAnchorPoint = "TOP"
  36.                 VariableList.currentSideGap = 0
  37.                 VariableList.currentYGap = NumberList.actionButtonYGap
  38.                 VariableList.currentButtonCount = VariableList.currentButtonCount + 1
  39.                 VariableList.topAnchorButton = thisButton
  40.             else
  41.                 VariableList.currentParentAnchorPoint = "BOTTOM"
  42.                 VariableList.currentAnchorButton = thisButton
  43.                 VariableList.currentChildAnchorPoint = "TOP"
  44.                 VariableList.currentSideGap = 0
  45.                 VariableList.currentYGap = NumberList.actionButtonYGap
  46.                 VariableList.currentButtonCount = VariableList.currentButtonCount + 1
  47.             end
  48. ]]--        
  49.         end
  50.     end
  51. end

This creates a column of 3 starting with the Reload button and then starts the next column to the right of the last button designated the "top button" of the last column.

Because the table you're cycling through (NewbDevBoxDisplayButtonTable) has string keys, they aren't sorted so you can't guarantee the order the buttons will be in.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote