SetProgressBarValue() changes font of other cell

I've been pulling my hair out trying to find out why some of the cells in my TMSFMXGrid keep switching to bold font. I finally narrowed it down to a call to TMSFMXGrid.SetProgressBarValue(int).


Whenever a row is selected in the Grid (in smDisjunctRow mode) and I call TMSFMXGrid.SetProgressBarValue(int) for the first column in this row, the text in the second column of this row will switch to bold. I created a small test project to make sure it is not something in my code.

It is basically just a FireMonkey project with a TButton and a TTMSFMXGrid on the main form. I then created an OnShow event to configure the Grid and an OnClick event on the Button to increment the ProgressBar value.

Here is the source code of the events:


void __fastcall TForm1::FormShow(TObject *Sender)
{
	Grid->RowCount = 10;
	Grid->FixedColumns = 0;
	Grid->FixedShowSelection = false;
	Grid->Options->Bands->Enabled = true;
	Grid->Options->Editing->Enabled = false;
	Grid->SelectionMode = smDisjunctRow;
	Grid->Options->Mouse->WheelScrollKeepSelection = true;
	Grid->Options->Mouse->ColumnAutoSizeOnDblClick = true;
	Grid->Options->Mouse->FixedColumnSizing = true;
	Grid->Options->Borders->CellBorders = bNone;
	Grid->Options->Borders->FixedCellBorders = bVertical;


	Grid->ColumnCount = 6;
	Grid->Cells[0][0] = "A";
	Grid->Cells[1][0] = "B";
	Grid->Cells[2][0] = "C";
	Grid->Cells[3][0] = "D";
	Grid->Cells[4][0] = "E";
	Grid->Cells[5][0] = "F";


	for (int i=1; i<Grid->RowCount; i++)
	{
		if (!Grid->IsProgressBar(0, i))
			Grid->AddProgressBar(0, i, 1);


		Grid->Cells[1] = "B:" + IntToStr(i);
		Grid->Cells[2] = "C:" + IntToStr(i);
		Grid->Cells[3] = "D:" + IntToStr(i);
		Grid->Cells[4] = "E:" + IntToStr(i);
		Grid->Cells[5] = "F:" + IntToStr(i);
	}
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button1Click(TObject *Sender)
{
	Grid->SetProgressBarValue(0, 1, Grid->GetProgressBarValue(0, 1) + 1);
}
//---------------------------------------------------------------------------


Can somebody confirm this is a bug in the TMSFMXGrid code and not something I'm doing wrong?

Hi, 


The grid takes over the column styles for normal states and fixed states. The default style is applied when the grid cell has any other state. Since the style in this sample is mixed (due to the use of banding) you can turn off columns with Grid->UseColumns = false; which should then render the cell according to the default style, and not the column style. You can change any cell state appearance within the style designer or programmatically with one of the appearance/layout events.

Kind Regards, 
Pieter

Pieter Scheldeman2015-03-16 11:44:52

Thank you. That fixed it.