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:
local function buttonFrameButtonLayout()
for k, v in pairs(ButtonTable) do
if v then
thisButton = "ButtonFrame" .. k
thisButton:ClearAllPoints()
thisButton:SetPoint(
VariableList.currentParentAnchorPoint,
VariableList.currentAnchorButton,
VariableList.currentChildAnchorPoint,
VariableList.currentSideGap,
VariableList.currentYGap
)
VariableList.currentAnchorButton = thisButton
if VariableList.currentButtonCount == 3 then
VariableList.currentParentAnchorPoint = "LEFT"
VariableList.currentAnchorButton = VariableList.topAnchorButton
VariableList.currentChildAnchorPoint = "RIGHT"
VariableList.currentSideGap = NumberList.actionButtonSideGap
VariableList.currentYGap = 0
VariableList.currentButtonCount = 1
elseif VariableList.currentButtonCount == 1 then
VariableList.currentParentAnchorPoint = "BOTTOM"
VariableList.currentAnchorButton = VariableList.topAnchorButton
VariableList.currentChildAnchorPoint = "TOP"
VariableList.currentSideGap = 0
VariableList.currentYGap = NumberList.actionButtonYGap
VariableList.currentButtonCount = VariableList.currentButtonCount + 1
VariableList.topAnchorButton = thisButton
end
end
end
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.