Issues with TMSFNCDataGrid (Scrolling and Rendering)

I am replacing TAdvStringGrid with the new TMSFNCDataGrid.

I have two "problems". Following Steps to reproduce it:

  • Set RowCount to 150 or something similar
  • Add about 30 Columns
  • Set Options.Mouse.WheelScrollKeepSelection to False
  • Set Options.Mouse.WheelScroollSize to 1
  • In the Constructor set the following Code to populate the Grid
	for(int nRow{0}; nRow < this->TMSFNCDataGrid1->RowCount; ++nRow)
	{
		for(int nCol{0}; nCol < this->TMSFNCDataGrid1->ColumnCount; ++nCol)
		{
			this->TMSFNCDataGrid1->Strings[nCol][nRow] = L"Test " + IntToStr(nCol) + L" " + IntToStr(nRow);
		}
	}

Now to the issues that i have.

First one
When the window is maximized scrolling is slow. You can notice a delay when Mousewheel is scrolled and the actual selection change is renderes. When the Window is not maximized scrolling has normal speed and selection is changed immediatly when Mousewheel is scrolled.

Second
This issue occurs on a High-DPI-Screen. When Manifest is set to per Monitor V2 (maybe on other too, but this one i tested so far). Some Gridlines are rendered with double the width. On a Monitor with 100% scaling it looks normal.

Hi,

We noticed some performance issues under these circumstances and did some improvements. Next version will address this.

We are still looking at the high DPI issue and this might take some time.

Thanks for the feedback!

1 Like

Can you provide a sample or code snippet ?, did you enable column stretching because we noticed something related to column stretching that we have fixed.

Hi Pieter,

Perfect, thank you!

See the attached example below. It looks like it has to do with the scaling of the monitor. At work i have set scaling to 125% and some Gridlines are a little thicker than other (vertical + horizontal) as you can see in the first post.

At home i have a monitor that is set to 150% scaling. Here i have only vertical lines, that are a littel thicker as you can see here:

sample.zip (22.6 KB)

Thanks for the sample!, issue is fixed, the DPI scaling calculated values with rounding issues for the column width. Next version will address this. Since we already released an update, the fix is going in the version for next week. If you want an urgent fix: open VCL.TMSFNCDataGridRenderer and use Int() around the calculation for DefaultColumnWidth & DefaultRowHeight:

procedure TTMSFNCDataGridRenderer.ChangeDPIScale(M: Integer; D: Integer);
begin
  inherited;
  BeginUpdate;
  try
    CellAppearance.FixedLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.FixedLayout.Font.Height, M, D);
    CellAppearance.NormalLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.NormalLayout.Font.Height, M, D);
    CellAppearance.GroupLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.GroupLayout.Font.Height, M, D);
    CellAppearance.SummaryLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.SummaryLayout.Font.Height, M, D);
    CellAppearance.SelectedLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.SelectedLayout.Font.Height, M, D);
    CellAppearance.FocusedLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.FocusedLayout.Font.Height, M, D);
    CellAppearance.FixedSelectedLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.FixedSelectedLayout.Font.Height, M, D);
    CellAppearance.BandLayout.Font.Height := TTMSFNCUtils.MulDivInt(CellAppearance.BandLayout.Font.Height, M, D);
    DefaultRowHeight := Int(TTMSFNCUtils.MulDivSingle(DefaultRowHeight, M, D));
    DefaultColumnWidth := Int(TTMSFNCUtils.MulDivSingle(DefaultColumnWidth, M, D));
  finally
    EndUpdate;
  end;
end;
1 Like