[Gambas-user] GridView adjust column length
Pino Zollo
pinozollo at ...626...
Thu Jul 9 19:30:48 CEST 2009
Il venerdì 3 luglio 2009 13:19:57 Stephen Bungay ha scritto:
HI Stephen,
Is there some special setup ?
I always get .Font.Width(.Current.Text) = 0 so no change is done.
I am on Debian 5.0.1, Gambas 2.14, QT and Gnome
It is the same using TableView instead GridView
Best regards
Pino
> '***********************************************************************
> '* AdjustGridColumns
> '* Author: Stephen Bungay
> '* Date: July 26 2006
> '*
> '* Parameters:
> '* GridView
> '*
> '* Calls: Nothing
> '*
> '* Adjusts the column sizes of the gridview being used for data
> '* presentation. Ensures that all of the data is visible.
> '*
> '**************************************************************************
> PUBLIC SUB AdjustGridColumns(pPassedGrid AS GridView)
>
> 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
> IF .Font.Width(.Current.Text) > MaxWidth THEN ' <---always
FALSE
> MaxWidth = .Font.Width(.Current.Text) + 10
> END IF
>
> NEXT
> .Columns[$Col].Width = MaxWidth
> NEXT
>
> END WITH
> END
--
Key ID: 0xF6768208
Key fingerprint = B16D 0A7C 5B29 A334 CE6A 71F6 EAF8 3D88 F676 8208
Key server: hkp://wwwkeys.eu.pgp.net
More information about the User
mailing list