Add columnlist:ResizeColumns

This commit is contained in:
Kenny Shields 2014-08-23 21:05:08 -04:00
parent 62f95614f4
commit c5157379ae
2 changed files with 30 additions and 1 deletions

View File

@ -859,4 +859,30 @@ function newobject:GetColumnWidth(id)
return false
end
--[[---------------------------------------------------------
- func: ResizeColumns()
- desc: resizes the object's columns to fit within the
width of the object's list area
--]]---------------------------------------------------------
function newobject:ResizeColumns()
local children = self.children
local width = 0
local vbody = self.internals[1]:GetVerticalScrollBody()
if vbody then
width = (self:GetWidth() - vbody:GetWidth())/#children
else
width = self:GetWidth()/#children
end
for k, v in ipairs(children) do
v:SetWidth(width)
self:PositionColumns()
self.internals[1]:CalculateSize()
self.internals[1]:RedoLayout()
end
end

View File

@ -285,7 +285,10 @@ function newobject:CalculateSize()
end
else
if self.hbar then
self:GetHorizontalScrollBody():Remove()
local hbar = self:GetHorizontalScrollBody()
hbar:Remove()
self.itemheight = self.itemheight - hbar.height
self.extraheight = self.itemheight - height
self.hbar = false
self.offsetx = 0
end