TMSFNCDataGrid Streching Columns

TMSFNCDataGrid:
if Streching is enabled in (Options-Column-Streching)

  1. The user cannot resize a column
  2. The Columns have a MinWidth i cant find

How to strech the columns and after that the user can resize a column
Where i can set the MinSize for Streching

Enabling stretching enables automatic column calculation for all columns to the available width of the control. You can auto stretch a single column and manipulate the others by changing the stretch mode.

TMSFNCDataGrid1.Options.Column.Stretching.Enabled := True;
TMSFNCDataGrid1.Options.Column.Stretching.Mode := gstmIndex;

By default the index is -1, which automatically takes the last column.

I would like to trim all columns to their maximum required width with following code:

GlobalFont.Name := FontNameGlobal; // Font des Grids setzen
Options.Filtering.Enabled := True; // Filter im Header einschalten
Options.Sorting.Enabled := True;   // Sortierung im Header
Options.Selection.Mode := gsmSingleRow;
DefaultColumnWidth:=100;
Options.Column.Stretching.Enabled:=True;
Options.Column.Stretching.Index := -1;
Options.Column.Stretching.Mode := gstmAll;

But the Width of all columns is then 100, also those with a maximum needed width of 50.

Another possibility would be to delete all columns and only add the required columns with their widths and set Strech to false.
What code would be necessary for this.

If you know the data, you can call AutoSizeColumns, which will calculate and set the width of all columns to the width it requires.

If i call AutoSizeColumns outside of my initialization procedure then it works fine.

But if i would add my Columns separate to the DataGrid that is bound to an Adapter that is bound to a Database.
How to add a Column to the Grid with the Fieldname Nachname:

like this:

GridKunden.Columns.Clear;
Column:=GridKunden.Columns.Add; (Column.fieldbyName ????)
Column.Header := 'Nachname';
Column.Width := 100;

AutoCreateColumns = False, and you have 0 columns in the grid, you can tell the database adapter which fields you want and where you want them to be, then it's only required to execute this code:

TMSFNCDataGridDatabaseAdapter1.FieldNames[0] := 'ID';
TMSFNCDataGridDatabaseAdapter1.FieldNames[1] := 'NAME';
TMSFNCDataGridDatabaseAdapter1.FieldNames[2] := 'ADDRESS';