[Gambas-user] Treeview auto resize
Dan Sheffner
message at ...2228...
Fri Sep 18 05:03:23 CEST 2009
I found this code but when I have a ton of rows it stalls the app: Trying
to find a solution for a treeview that has 100,000+ records.
PUBLIC SUB AdjustGridColumns(pPassedGrid AS TableView)
DIM $Row AS Integer
DIM $Col AS Integer
DIM MaxWidth AS Integer
MaxWidth = 0
WITH pPassedGrid
.Columns.Resizable = TRUE
FOR $Col = 0 TO .Columns.Count - 1
.Row = 0
.Column = $Col
MaxWidth = .Current.Width
FOR $Row = 0 TO .Rows.Count - 1
.Row = $Row
' DEBUG .Current.Text ' <--- always
empty
' DEBUG .Font.Width(.Current.Text) ' <--always 0
IF .Font.Width(.Current.Text) > MaxWidth THEN
MaxWidth = .Font.Width(.Current.Text) + 10
END IF
NEXT
' DEBUG $Col, MaxWidth ' <-- always 99
.Columns[$Col].Width = MaxWidth
NEXT
END WITH
END
On Thu, Sep 17, 2009 at 8:00 PM, Dan Sheffner <message at ...2228...>wrote:
> Does anyone have a sub or the code to automatically resize columns on a
> trueview to fit text? Thanks in advance.
>
More information about the User
mailing list