k, it is working now... I moved the grabbing of the buttons one layer higher:
lua Code:
local lib = {}
lib.buttonFuncProxy = {}
--[[ VOID noop()
This prevents the default UI from altering our stuff!
]]
lib.noop = function() end
--[[ VOID MoveButton(BUTTON button, INT sizeX, INT sizeY, ARRAY pos)
Moves a button (which is in use, meaning visible) to the correct position.
ARRAY pos is defined as an array which holds the position information as it is used in SetPoint()
]]
lib.MoveButton = function(button, sizeX, sizeY, pos)
button:ClearAllPoints()
-- button:SetSize(sizeX, sizeY)
lib.buttonFuncProxy[button:GetName()..'SetSize'](button, sizeX, sizeY)
-- button:SetPoint(unpack(pos))
lib.buttonFuncProxy[button:GetName()..'SetPoint'](button, unpack(pos))
end
--[[ VOID HandleButtonBar
FRAME parent
STRING key - the string to access settings in arrays
OTHER INPUT IS DOCUMENTED at lib.HandleButton !!!
]]
lib.HandleButtonBar = function(parent, key, sizeX, sizeY)
-- lib.debugging('HandleButtonBar() '..key..', '..settings.static.NumButtons[key]..', '..PredatorButtonsSettings[key].buttons)
local i, button, bname
for i = 1, settings.static.NumButtons[key] do
button = _G[settings.static.ButtonPrefix[key]..i]
bname = button:GetName()
if ( not lib.buttonFuncProxy[bname..'SetSize'] ) then
lib.buttonFuncProxy[bname..'SetSize'] = button.SetSize
button.SetSize = lib.noop -- don't do this anymore!
end
if ( not lib.buttonFuncProxy[bname..'SetPoint'] ) then
lib.buttonFuncProxy[bname..'SetPoint'] = button.SetPoint
button.SetPoint = lib.noop -- don't do this anymore!
end
if ( i <= PredatorButtonsSettings[key].buttons ) then -- magic happening here!
if ( i == 1 ) then
lib.MoveButton(button,
sizeX, sizeY,
{'TOPLEFT', parent, 'TOPLEFT',
PredatorButtonsSettings[key].padding,
-PredatorButtonsSettings[key].padding
} )
else
lib.MoveButton(button,
sizeX, sizeY,
{'TOPLEFT', parent, 'TOPLEFT',
( ((i-1)%PredatorButtonsSettings[key].columns)*(PredatorButtonsSettings[key].buttonSize+2*PredatorButtonsSettings[key].padding)+PredatorButtonsSettings[key].padding ),
-( (floor((i-1) / PredatorButtonsSettings[key].columns))*(PredatorButtonsSettings[key].buttonSize+(2*PredatorButtonsSettings[key].padding))+PredatorButtonsSettings[key].padding )
} )
end
else
button:ClearAllPoints()
-- button:SetPoint('BOTTOMRIGHT', UIParent, 'TOPLEFT', -5, 5) -- out of sight, out of mind!
lib.buttonFuncProxy[bname..'SetPoint'](button, 'BOTTOMRIGHT', UIParent, 'TOPLEFT', -5, 5)
end
end
end
Thx for your reply Saiket, your confirmation was necessary and I think you solved it by pointing out, that maybe I'm filling the array twice!