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 <mess...@digisoftinc.org>wrote:

> Does anyone have a sub or the code to automatically resize columns on a
> trueview to fit text?  Thanks in advance.
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to