diff --git a/changelog.txt b/changelog.txt index f9445d6..63d08a3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -14,6 +14,7 @@ Version 0.9.9 - Alpha (Release Date TBD) [ADDED] a new columnlistarea method: GetVerticalScrollBar() [ADDED] a new columnlistarea method: GetHorizontalScrollBar() [ADDED] a new columnlist method: GetTotalColumnWidth() +[ADDED] a new columnlist method: SetColumnWidth(id, width) [ADDED] a new columnlist method: GetColumnWidth(id) [FIXED] bug that would cause tabbuttons to be positioned incorrectly when scrolling with the mouse wheel diff --git a/objects/columnlist.lua b/objects/columnlist.lua index a79b929..2c9611a 100644 --- a/objects/columnlist.lua +++ b/objects/columnlist.lua @@ -825,7 +825,7 @@ end --[[--------------------------------------------------------- - func: GetTotalColumnWidth() - - desc: gets the combined width of the objects columns + - desc: gets the combined width of the object's columns --]]--------------------------------------------------------- function newobject:GetTotalColumnWidth() @@ -839,6 +839,28 @@ function newobject:GetTotalColumnWidth() end +--[[--------------------------------------------------------- + - func: SetColumnWidth(id, width) + - desc: sets the width of the specified column +--]]--------------------------------------------------------- +function newobject:SetColumnWidth(id, width) + + local column = self.children[id] + if column then + column.width = width + local x = 0 + for k, v in ipairs(self.children) do + v:SetPos(x) + x = x + v.width + end + self.internals[1]:CalculateSize() + self.internals[1]:RedoLayout() + end + + return self + +end + --[[--------------------------------------------------------- - func: GetColumnWidth(id) - desc: gets the width of the specified column