View Full Version : Getting table column widths right

Jun 25, 2012, 08:00 AM
I am cleaning up an ODBC tool and I've run across a minor but annoying problem...

During the setup of the output display table, we look at the only two pieces of data we have to try to select a column width. Those bits of data are the declared width of the column, and the column name. We select the larger of the two.

The problem is that the real-world may or may not be similar to either of those. Often the field is set up much larger than it needs, "just to be safe". As a result, the columns end up much wider than they should be.

In those cases, double-clicking the table header contracts the table to the correct size. I would like to add this logic into the choice of column width.

Has anyone done this before that might have a best-practices suggestion for me?