|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
GridView adjust column lengthI'm filling a very simple GridView with the below code but I cannot adjust
the column length. I have resizable set to TRUE and I have also tried to do GridView1.resizable = TRUE after the grid is populated with the values. Am I missing something or using the wrong property? Also is there an auto length to make sure the whole column is visiable? Thanks in advance. FOR EACH sb IN arrayOfLines sb = Trim(sb) 'PRINT sb arrayOfSpaces = Split(sb, " ") GridView1[rowCount, 0].Text = arrayOfSpaces[0] GridView1[rowCount, 1].Text = arrayOfSpaces[1] at the bottom of the SUB: GridView1.Resizable = TRUE ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
GridView adjust column lengthI'm filling a very simple GridView with the below code but I cannot adjust
the column length. I have resizable set to TRUE and I have also tried to do GridView1.resizable = TRUE after the grid is populated with the values. Am I missing something or using the wrong property? Also is there an auto length to make sure the whole column is visiable? Thanks in advance. FOR EACH sb IN arrayOfLines sb = Trim(sb) 'PRINT sb arrayOfSpaces = Split(sb, " ") GridView1[rowCount, 0].Text = arrayOfSpaces[0] GridView1[rowCount, 1].Text = arrayOfSpaces[1] at the bottom of the SUB: GridView1.Resizable = TRUE ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: GridView adjust column lengthTry this (from my GridUtils Class.. can't believe that was written 3
years ago now!) '*********************************************************************** '* 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 MaxWidth = .Font.Width(.Current.Text) + 10 END IF NEXT .Columns[$Col].Width = MaxWidth NEXT END WITH END Dan Sheffner wrote: > I'm filling a very simple GridView with the below code but I cannot adjust > the column length. I have resizable set to TRUE and I have also tried to do > GridView1.resizable = TRUE after the grid is populated with the values. Am > I missing something or using the wrong property? Also is there an auto > length to make sure the whole column is visiable? Thanks in advance. > > FOR EACH sb IN arrayOfLines > sb = Trim(sb) > 'PRINT sb > arrayOfSpaces = Split(sb, " ") > GridView1[rowCount, 0].Text = arrayOfSpaces[0] > GridView1[rowCount, 1].Text = arrayOfSpaces[1] > > > at the bottom of the SUB: > > GridView1.Resizable = TRUE > ------------------------------------------------------------------------------ > _______________________________________________ > Gambas-user mailing list > Gambas-user@... > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: GridView adjust column lengthWow thank you very much...this sub is great.
On Fri, Jul 3, 2009 at 12:19 PM, Stephen Bungay <sbungay@...> wrote: > Try this (from my GridUtils Class.. can't believe that was written 3 > years ago now!) > > '*********************************************************************** > '* 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 > MaxWidth = .Font.Width(.Current.Text) + 10 > END IF > > NEXT > .Columns[$Col].Width = MaxWidth > NEXT > > END WITH > END > > > Dan Sheffner wrote: > > I'm filling a very simple GridView with the below code but I cannot > adjust > > the column length. I have resizable set to TRUE and I have also tried to > do > > GridView1.resizable = TRUE after the grid is populated with the values. > Am > > I missing something or using the wrong property? Also is there an auto > > length to make sure the whole column is visiable? Thanks in advance. > > > > FOR EACH sb IN arrayOfLines > > sb = Trim(sb) > > 'PRINT sb > > arrayOfSpaces = Split(sb, " ") > > GridView1[rowCount, 0].Text = arrayOfSpaces[0] > > GridView1[rowCount, 1].Text = arrayOfSpaces[1] > > > > > > at the bottom of the SUB: > > > > GridView1.Resizable = TRUE > > > ------------------------------------------------------------------------------ > > _______________________________________________ > > Gambas-user mailing list > > Gambas-user@... > > https://lists.sourceforge.net/lists/listinfo/gambas-user > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Gambas-user mailing list > Gambas-user@... > https://lists.sourceforge.net/lists/listinfo/gambas-user > _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: GridView adjust column lengthIl 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 > 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 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
| Free embeddable forum powered by Nabble | Forum Help |