From ac5818b1020a81ca135df15ef7c9a14d10fb85d1 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Sat, 23 Aug 2014 03:04:31 -0400 Subject: [PATCH] Add columnlist:SetColumnWidth --- changelog.txt | 1 + objects/columnlist.lua | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) 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