Subject Re: column widths of ib_grid
Author jeffplata
--- In, Helen Borrie <helebor@...> wrote:
> 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
> 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

Thank you, Helen. Taking your advice I was able to achieve a resized
form based on ib_grid column widths. I used the following method:

for i := 0 to ib_grid1.GridFieldCount-1 do
fw := fw + TIB_Column(ib_grid1.GridFields[i]).DisplayWidth;
self.ClientWidth := fw + ib_grid1.RowIndicatorColWidth +i +20;

In a related situation, I find it impossible to resize the dropdown
width of an ib_lookupcombo by setting the width of the underlying
column. The control is set to display a single column, description,
via the ib_lookupcom.gridlinks property. I can set the dropdownwidth
property to match the lookupcombo width but if I do that, a nasty
horiz scollbar appears in a dropdown- not so elegant. Can you tell me
please how to match the dropdown width to the combo width.