It is difficult to know how to size columns in a table in program, especially when creating the table dynamically. The best you can do is guess based on the estimated size of what is going to be returned.
If you double-click the heading in between two columns it auto-sizes the left column. It would be useful if there was a function or attribute which could do this.
Please add my vote to this request also.
Quote from: Tim Bell on November 25, 2008, 01:18:35 PM
It is difficult to know how to size columns in a table in program, especially when creating the table dynamically. The best you can do is guess based on the estimated size of what is going to be returned.
If you double-click the heading in between two columns it auto-sizes the left column. It would be useful if there was a function or attribute which could do this.
I don't know if you have noticed but that double-click only sizes based on the data that the GDC knows about i.e. the rows that are visible.
You can set the width attribute of the column by manipulating the DOM tree. I've done that successfully in a routine that essentially takes the output from a SQL statement and dumps it into a DISPLAY ARRAY. For each column set the width attribute to an appropriate value for the data in that column.
Quote from: Reuben Barclay on November 25, 2008, 09:45:53 PM
I don't know if you have noticed but that double-click only sizes based on the data that the GDC knows about i.e. the rows that are visible.
You can set the width attribute of the column by manipulating the DOM tree. I've done that successfully in a routine that essentially takes the output from a SQL statement and dumps it into a DISPLAY ARRAY. For each column set the width attribute to an appropriate value for the data in that column.
I'd not noticed this, but I shouldn't think It will be a big problem. I'd thought of checking the length of data in each column in the array (as well as the column title), but it's bit of a long winded way of doing things, and the WIDTH attribute is (I think) in grid chars which isn't really the same as the width the data occupies in the table due to the differences in font size.