FNCGrid row height problem

Hi - I'm using the OnGetCellLayout event to get format info from an
Excel worksheet (using Flexcel). For large fonts I set the row height to
fit using FGrid.RowHeights[ARow] but only part of the row (the cells
after the event cell) are correctly set. I've tried various combinations
of UpdateGridCells/Repaint/Refresh/BeginUpdate/Endupdate but nothing
fixes it. If I resize the grid or double-click on it then the row height
gets corrected across the whole row.

I tried to insert an image but there doesn't appear to be a file browse option.

Thanks, Bob

Forgot to say this is Vcl using Tokyo update 2.


There is currently no file browse option in the grid built-in. This is due to the fact that there is no file picker on iOS/Android. Are you forcing the rowheights inside the OnGetCellLayout event? Please note that the RowHeights property should not be accessed from within this event, but from the constructor of the form, or initialization code from a button click.

Hi Pieter - yes I've been setting the row heights within
OnGetCellLayout. I'm using virtual mode with Flexcel. I could track the
different row heights as the data is loaded and then do a global update
but can't see a suitable event (OnAfterDraw just gets me into a loop).
Any ideas?

Thanks, Bob

The RowHeights property is currently the only way to set the height of a row. This is needed to calculate scrolling dimensions.

Yes I realise that - the problem is where best to call RowHeights. If I can't call it within OnGetCellLayout then I need something like this:
1. Initialise list of row heights in a grid-level event
2. set row height list values within OnGetCellLayout based on font sizes from Flexcel
3. Apply row heights in a grid-level event

The trouble is that it might be difficult to avoid an endless loop....

Thanks, Bob

You'll need to pre-loop through the Excel file in order to retrieve the correct row-heights. Once set, there is no need to re-initialise them. This can be done after the grid rowcount/columncount is set. I suppose this code is somewhere in your application, as this is necessary before the events are called to retrieve the virtual data from Flexcel.

Ok thanks - was trying to avoid pre-looping but will give it a go.