TTMSFNCGrid Stretch Column

Hi,

I use TTMSFNCGrid in a TMS Web Core application.

I link the Grid to a Adapter and TWebDataSource in runtime.

When i have a TWebDataSource i link to a DataAdapter and then active it.

After i active the adapter i want to configute auto stretch column to expand to width of the grid.

I use this code:

... prepare TWebClientDataSet with 5 columns.
... Adapter Name is: dbaGRID
... Grid Name is: sgGRID

 dbaGRID.Active:=true;

 sgGRID.Options.ColumnSize.Stretch:=true;
 sgGRID.Options.ColumnSize.StretchColumn:=2;

When i run the project the column that is expanded is always the last one instead of the one I am indicating (2 in the example).

I use the last version of tms WebCore ans FNC Components.

Can you help me ?

Thanks

I attach a little project with the issue example...

Thanks
WEBCORE_TestFNCgrid.zip (22.4 KB)

I noticed you set the StretchColumn to 1 in your sample, not 2. Which in case of the data is the second column (0 index based). So the behavior you see is as expected. The behavior is as follows:

Stretch := True stretches all columns to the available width.
StretchColumn := 1, sets the width of this column to the remainder space after stretching all columns.

Hi Pieter,

In the example there ara 4 columns:

Column Number Column Name


0 clien
1 nom
2 cp
3 ventas

The documentation say that for autoexpand the column 1 (nom) the code is:

grid.Stretch:=true;
grid.StretchColumn:=1;

If i write this code like in the project example the column expanded is the last one: 3 - ventas (Not correct, i want the column 1).

If you try to modify StretchColumn to 0,1,2 always autoexpand the last one ( 3 - ventas )

If you make this properties in design mode runs ok, but if you try to make this properties in code (runtime) not run properly. Always expand the last column.

Have you tried the project that I gave you? does it work for you?

If you see any issue in my code, please tell me so i can correct it...

Before i try it i update my TMS Web Core and FNC versions for the last...

Thanks

PD: The property that autoexpands all columns proportionally is StretchAll no Stretch. Stretch autoexpand only the column indicates in StretchColumn. If i'm not wrong).

OK, now I see the mistake. Please set grid.StretchColumn := 1 before grid.Stretch := True;