Subject Re: [IBO] column widths of ib_grid
Author Helen Borrie
At 03:28 PM 22/02/2006, you wrote:
>How to read and/or set the individual column widths of an ib_grid at
>runtime? Something in the line of:
> w := ib_grid1.colwidth[1];
> ib_grid1.colwidth[1] := 50;
>
>I wanted to know this because I need to resize my form to display all
>the columns of a grid (without horiz scrollbars), if possible.

In IB_controls, the data determines the dimensions. So access the
DisplayWidth property of TIB_Column, or the FieldsDisplayWidth list
of the dataset, to get or set the width in pixels. Use the
GridFields[n] property of the grid to get hold of the actual column
object underlying the grid column.

E.g. let's suppose a simple routine to set all of the visible fields
to 50 pixels (unlikely, I know, but it gives the picture!)

var
ii: integer;
.....

with ib_grid1 do
for ii := 0 to GridFieldCount - 1 do
TIB_Column(GridFields[ii]).DisplayWidth := 50;

Helen


Helen