[Gambas-user] Column auto reseize in tables views.

Charlie Reinl Karl.Reinl at ...9...
Sun Aug 2 13:04:35 CEST 2009


Am Sonntag, den 02.08.2009, 11:54 +0200 schrieb Benoît Minisini:
> > Il sabato 1 agosto 2009 19:36:51 David Villalobos Cambronero ha scritto:
> > > Hi all,
> > >
> > > How can I automaticly auto resize the column width of my gridview or
> > > tableview. I mean, when I show the view, I want all the columns adjusted
> > > to the cell content.
> > >
> > >  Regards
> > >
> > >
> > > --
> > > David
> >
> > You can't automatically. You could write a function
> > to calculate the maximum length of a cell content
> > in the same column and then change the column width.
> > The basic thing is that you have to calculate the width
> > of a cell content. You could do this:
> >
> > Dim iContentW as Integer
> >
> > iContentW = GridView1.Font.Width(GridView1[0,0].Text)
> >
> > Once you have the longest cell content, you can resize that
> > column adding a little value.
> >
> > GridView1.Columns[0].Width = iContentW + 10
> >
> > You have to calculate the width of all cell content of a specific row,
> > select the longest, resize the column. Not comfortable, but not impossible.
> >
> >
> > Bye,
> >
> > Stefano
> >
> 
> Normally, setting the column width or row height to -1 does the job, but:
> - It seems to work strangely when the GridView is filled by the Data event.
> - It is not implemented in gb.gtk yet.
> 

Salut Benoit,

while talking GridView. I think that belongs to that subject.

I moving a gambas1 project to gambas2, and remarked,
that with GridView you can't have EmptySpace at right in a
Grid (gambas1.png) At that time I used the TableView component. 

With GridView from gambas2 (gambas2.15.2) even the Field which is set
during creation like that :        
	ME.Columns[ME.Columns.Count - 1].Width = 0
        ME.Columns[ME.Columns.Count - 1].Resizable = FALSE
is now visible.(gambas2.png)

Do you have a hint for that.



-- 
Amicalment
Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambas1.png
Type: image/png
Size: 33189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090802/e94b9676/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambas1.png
Type: image/png
Size: 33189 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20090802/e94b9676/attachment-0001.png>


More information about the User mailing list