Quantcast
Dynamic Button Layouts - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-22-21, 07:30 PM   #1
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 144
Dynamic Button Layouts

Hi all

I have a frame that will contain buttons.

I have a number of buttons that will differ based on checkbox selections.

Each button is already created, (all in lua), yet they have no default anchor points.

I have tried to build a function that should layout the buttons correctly yet I keep getting
attempt to call method 'ClearAllPoints' errors

This is my very first attempt at such a function and I have tried many different ways all with the same outcomes.

Here is my last function;
Lua Code:
  1. local function buttonFrameButtonLayout()
  2.     for k, v in pairs(ButtonTable) do
  3.         if v then
  4.             thisButton =  "ButtonFrame" .. k
  5.             thisButton:ClearAllPoints()
  6.             thisButton:SetPoint(
  7.             VariableList.currentParentAnchorPoint,
  8.             VariableList.currentAnchorButton,
  9.             VariableList.currentChildAnchorPoint,
  10.             VariableList.currentSideGap,
  11.             VariableList.currentYGap
  12.             )
  13.  
  14.             VariableList.currentAnchorButton = thisButton
  15.  
  16.             if VariableList.currentButtonCount == 3 then
  17.                 VariableList.currentParentAnchorPoint = "LEFT"
  18.                 VariableList.currentAnchorButton = VariableList.topAnchorButton
  19.                 VariableList.currentChildAnchorPoint = "RIGHT"
  20.                 VariableList.currentSideGap = NumberList.actionButtonSideGap
  21.                 VariableList.currentYGap = 0
  22.                 VariableList.currentButtonCount = 1
  23.             elseif VariableList.currentButtonCount == 1 then
  24.                 VariableList.currentParentAnchorPoint = "BOTTOM"
  25.                 VariableList.currentAnchorButton = VariableList.topAnchorButton
  26.                 VariableList.currentChildAnchorPoint = "TOP"
  27.                 VariableList.currentSideGap = 0
  28.                 VariableList.currentYGap = NumberList.actionButtonYGap
  29.                 VariableList.currentButtonCount = VariableList.currentButtonCount + 1
  30.                 VariableList.topAnchorButton = thisButton
  31.             end
  32.         end
  33.     end
  34. end

I have also tried to build the buttons on the fly yet some buttons run a macro whilst others have onclick functions and that also has been punishing.

What is the proper way to solve this issue?

Also, I have a view to making the frame resizable so the buttons will need to shift at the same time, though this a want to, rather than a need to.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Dynamic Button Layouts

Thread Tools
Display Modes

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