View Single Post
01/22/19, 10:35 PM   #3
Akira.Iris
Join Date: Jun 2018
Posts: 4
Thanks Baertram! I had the anchors set already (in xml, not via SetAnchor()), but that didn't seem to affect anything, but it got me thinking that maybe it's not the scroll list that's not getting resized.

So I used zgoo to check the width of all child elements to see which ones were wrong and found that the columns in the row element were remaining unchanged. I was able to track down (for the most part) how Arkadius Tools does the resize:

First in xml they create a self.Update function to adjust width of the headers as the parent gets resized.
Code:
            <OnInitialized>
                self.Update = function(self)
                    
                    for i = 1, self:GetNumChildren() do
                        local header = self:GetChild(i)

                        ... do some resize code
                    end

                end

                self:Update()
            </OnInitialized>
Then they link headers to each column in the Row template.
Code:
           <OnInitialized>
                local headers = self:GetParent():GetParent():GetParent():GetNamedChild("Headers")
                local headersName = headers:GetName()

                for i = 1, headers:GetNumChildren() do
                    local header = headers:GetChild(i)

                    if ((header.key) and (header.key ~= "headerSettings")) then
                        local column = header:GetName():gsub(headersName, "")
                        self:GetNamedChild(column).header = header
                    end
                end
            </OnInitialized>
Then in lua in SetupRow function they assign the width from the header to the column:
Code:
 
    ...
    -- getting each column element
    local sellerName = GetControl(rowControl, "SellerName")
    local buyerName = GetControl(rowControl, "BuyerName")
    
    sellerName:SetWidth(sellerName.header:GetWidth() - 10)
    buyerName:SetWidth(buyerName.header:GetWidth() - 10)

    ... some other row setup code

   ...

So that got it working somewhat.... I think I still need to trigger the scroll list refresh on resize somewhere, because right now it will only resize as the list gets changed/populated, but not when the window gets resized, but I think that's the bulk of what I was looking for.

Last edited by Akira.Iris : 01/22/19 at 10:59 PM.
  Reply With Quote