TMSFMXGrid AutoSizeRows() doesn't work?

Hello,


we are using TMSFMXGrid with C++ Bulder XE 4. I have a Cell in which is a Text with a few Linebreaks.
I tried to call "AutoSizeRows()", so that the content fit into the Cell, but nothing happend. Am I doing something wrong?

Hi, 


The autosizing works only if the height of the row is higher than the text, so the autosize you can set the defaultrowheight to a higher value, then apply autosizing on the row:

  TMSFMXGrid1.DefaultRowHeight := 500;
  TMSFMXGrid1.AutoSizeRows;

Kind Regards, 
Pieter

Doesn't work...

No solution?

Doesn't work isn't very helpful, please send us your sample with specific data that fails on autosizing so we can investigate here.


Kind Regards, 
Pieter

So i found something...

For Testing:

Drop a TMSFMXGrid on a Form and in the Constructor add the following Lines of Code:

this->TMSFMXGrid1->DefaultRowHeight = 150;
this->TMSFMXGrid1->Cells[1][1] = "This is a Test\r\n for Autosizing Rows\r\nwith a TMSFMXGrid";
this->TMSFMXGrid1->AutoSizeRows();

This doesn't work. But if i drop a Butoon on the Form and do the "this->TMSFMXGrid1->AutoSizeRows();" in the Button-Click-Event, everything works.

So what can I do, that this works after filling the Grid?
Hi, 

Implement the OnApplyStyleLookUp event and call TMSFMXGrid1->AutoSizeRows(); there.
This event is triggered after the style is applied and the cells are loaded.

Kind Regards, 
Pieter

Perfect, thank you