Subject Re: [IBO] Saving grid layouts
Author Paul Vinkenoog
Hello Steve,

> Does anyone know of a simple way to save the layouts of
> the TIB_Grids? I have enabled my users to go to a mirrored
> grid of a working grid and make column layout changes and save
> them but am not able to save if they make changes to the order
> of the columns (from left to right). They can change things such
> widths, title labels, alignment, etc.
>
> I am now using base statements such as:
>
> TIB_Query(Grid.DataSource.Dataset).FieldsDisplayWidth.Text
> TIB_Query(Grid.DataSource.Dataset).FieldsVisible.Text
>
> And it will save the display widths, visibility, and even changes
> to the column titles to a registry item, or an ini file, but I am
> unable to puzzle out how to save the ordering change (Left to Right).
> (I did start working out saving each of the TIB_Column parameters
> to a TStringList but that was getting to be too complicated for
> reloading the layouts when needed).

I've done this long ago in an application of mine (using IBO 4.3).

Just save and load Grid.GridLinks.CommaText; it contains the column
order, widths and alignments (the latter two only insofar as they
have changed from the default).

An example string taken from my Registry:

LLNUM,LLNAAM=WIDTH=299,KLAS=WIDTH=131,PAKKET=WIDTH=458

From the IBO Help:

When WIDTH is specified, only the current grid is affected. The
underlying TIB_Column will remain unaffected, hence other grids
won't be impacted.

[< tablename >.]< columnname >=ALIGN=< Left|Center|Right >

When ALIGN is specified, only the current grid is affected. The
underlying TIB_Column will remain unaffected, hence other grids
won't be impacted. Only the first letter is significative to specify
the field alignment.

Of course, you can mix the two specifications, for example:

myfield=WIDTH=45;ALIGN=C

It will take some extra work to save the visibility, column titles etc.
But it seems you have already done that.


Good luck!
Paul Vinkenoog