Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Calculating table column width
Calculating table column width [message #448314] Fri, 07 January 2005 01:38 Go to next message
Eclipse UserFriend
Originally posted by: skrap.post.gmail.com

I'd like to calculate the width for columns in a table where the cells
will have strings of varying lengths so I can set the width of the columns
as the data in the table changes. Pack() works fine for normal tables but
not so good for virtual tables. I'm not sure how to go from the string
length to an int to send to TableColumn.setWidth() and make it work
whatever font, fontsize etc the table might have.

If there is something that does this for virtual tables already, I've
missed it and apologize.

/Johan
Re: Calculating table column width [message #448403 is a reply to message #448314] Fri, 07 January 2005 22:44 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
If you have all the data already, don't use a virtual table and set it into
the table and use pack(). A virtual table can't pack() data it doesn't
have.

"Johan Karlsson" <skrap.post@gmail.com> wrote in message
news:crkp6c$rdj$1@www.eclipse.org...
> I'd like to calculate the width for columns in a table where the cells
> will have strings of varying lengths so I can set the width of the columns
> as the data in the table changes. Pack() works fine for normal tables but
> not so good for virtual tables. I'm not sure how to go from the string
> length to an int to send to TableColumn.setWidth() and make it work
> whatever font, fontsize etc the table might have.
>
> If there is something that does this for virtual tables already, I've
> missed it and apologize.
>
> /Johan
>
Re: Calculating table column width [message #448407 is a reply to message #448403] Fri, 07 January 2005 23:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: skrap.post.gmail.com

I do have all the data already but there can be quite a bit of it so I'd
really rather use a virtual table. I realize it can't pack data it doesn't
have, that's why I'm trying to do something like this since I have the
data and can find the longest strings for each column beforehand. It's not
vital or anything, it'd just be a nice detail.

/Johan

Steve Northover wrote:

> If you have all the data already, don't use a virtual table and set it into
> the table and use pack(). A virtual table can't pack() data it doesn't
> have.
Re: Calculating table column width [message #448458 is a reply to message #448407] Mon, 10 January 2005 17:43 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Why don't you insert the first 1000 items, make the rest virtual and pack()
that? For small tables (which are probably the majority of the cases), the
size will be right.

"Johan Karlsson" <skrap.post@gmail.com> wrote in message
news:crn7ic$6ue$1@www.eclipse.org...
> I do have all the data already but there can be quite a bit of it so I'd
> really rather use a virtual table. I realize it can't pack data it doesn't
> have, that's why I'm trying to do something like this since I have the
> data and can find the longest strings for each column beforehand. It's not
> vital or anything, it'd just be a nice detail.
>
> /Johan
>
> Steve Northover wrote:
>
> > If you have all the data already, don't use a virtual table and set it
into
> > the table and use pack(). A virtual table can't pack() data it doesn't
> > have.
>
>
>
Previous Topic:Test Coverage
Next Topic:control vs. listener event processing order
Goto Forum:
  


Current Time: Mon Oct 19 16:41:49 GMT 2020

Powered by FUDForum. Page generated in 0.01909 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top