TTMSFNCGrid and appearance

Hi All,

Just trying to get a look and feel for a FNC Grid. I have the grid working with an XData server. I have added 4 columns with the FNC Grid database adapter.
Then I started to set a few properties with the grid's columns property. I set the columns width property for each column, and the width changed at design time, but at run-time, the default width was used.

How do I set the width of each column?

Can I specify that the grid's RowSelect is true, so when I choose a row, the row is selected and not just a cell?

How can I colour alternate rows 2 different colours?

Thanks for any help,
Paul

I should have mentioned this is running inside a web core app.

When connecting with a dataset through the database adapter, the columns are recreated, and thus loosing the column/width. You can override this with TMSFNCGrid1.ColumnWidths property after the dataset has been activated.

For the RowSelect, you can change the Options.Selection.Mode property to smDisjunctRow and this should allow you to select a complete row.

For coloring rows, you can take a look at the OnGetCellLayout event, access the Layout property and change the fill. This way you can customize a cell, or multiple cells.

Additionally, please take a look at the documentation of the grid:
http://www.tmssoftware.biz/download/manuals/TMSFNCGridDevGuide.pdf
Pieter Scheldeman2018-11-20 15:10:05
Hi Pieter,

Thanks for the help. Much appreciated. Is there a property to specify 1 column as auto fit, so it will auto size to fill the width of the grid?

Cheers,
Paul

Hi,


Yes, you can turn on stretching and set the appropriate stretchcolumn with the following code:


TMSFNCGrid1.Options.ColumnSize.Stretch := True;
TMSFNCGrid1.Options.ColumnSize.StretchAll := False;
TMSFNCGrid1.Options.ColumnSize.StretchColumn := 1;

Hi Peter,

Thanks again. Could I just ask what the StretchColumn does? Is it suppose to indicate which column gets stretched? Regardless of the number I tried, it was always the last column that was stretched.

If this is not what that property is for, is there any way of specifying which column gets stretched?

Cheers,
Paul
All good, I figured it out. You need to set the StretchColumn before setting Stretch to True.

Cheers,
Paul

Thank you for your feedback!