I am working hard these days to add support for virtual using of grid.
And, I have next results:
Between TNxCustomGrid6 and TNextGrid6 I have added one more class TNextVirtualGrid. This class is also published on Components/Tool Palette on NextSuite 6 tab.
This class is actually a TNextGrid6 without Cells logic implemented, so it is virtual for you to connect it to your data directly.
Why to use virtual mode?
- If you already store data in some custom structure, with virtual mode you will not duplicate data. As you know NextGrid store own 2-dimensional array of cells.
- Sometimes your data is calculated (or streamed) and you don't have a need to store data anywhere.
How data is connected?
There is a non-visual component TNxVirtualCellSource6 (on NextSuite 6 tab too) which include events such as:
- OnGetRowCount
- OnGetCell
etc.
And, then you need to connect grid with this non-visual control.
For example, I have created 1 view and added 2 columns (text and number).
procedure TForm3.Button1Click(Sender: TObject); begin // Here we set connection NextVirtualGrid61.CellSource := NxVirtualCellSource61; end; procedure TForm3.NxVirtualCellSource61GetCell(Sender: TObject; ACol, ARow: Integer; Cell: INxCell); begin // Here we set value for cell, quite easy <img src='http://www.bergsoft.net/forum/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' /> case ACol of 0: Cell.AsString := 'test string'; 1: Cell.AsFloat := ARow; end; end; function TForm3.NxVirtualCellSource61GetRowCount(Sender: TObject): Integer; begin // Total number of rows. Result := 5; end;
Important note is that Columns will not be virtual, so you will need to add them in designer.
Please note that files are not yet uploaded, I will upload it in upcoming days. If you have any comments please tell me.
So far is working nice, but I need to check some it more.
Best regards