Here a small piece of code i posted elsewhere to illustrate how to use the TNxVirtualColumn.
btw Does anyone else have code to share here or is it just me filling this space :?: ?
1) add one (or more):
CODE
var
vc : TNxVirtualColumn;
begin
vc := NextGrid1.Columns.Add(TNxVirtualColumn, 'Virtual') as TNxVirtualColumn;
vc.DrawingOptions := doNormal;
vc.Name := 'VirtualColumn1';
vc.Header.Caption:= 'Virtual';
vc.OnGetText := MyGetText;
...
vc : TNxVirtualColumn;
begin
vc := NextGrid1.Columns.Add(TNxVirtualColumn, 'Virtual') as TNxVirtualColumn;
vc.DrawingOptions := doNormal;
vc.Name := 'VirtualColumn1';
vc.Header.Caption:= 'Virtual';
vc.OnGetText := MyGetText;
...
Now I'm looking at the code i think maybe the vc.Header.Caption line is not nececsary as the Caption is probably also set by the Add() function. The name has to be unique as holds for all delphi components added.
2) implement the OnGetTextevent handler like:
CODE
procedure TForm1.MyGetText(Sender: TObject; const ACol, ARow: Integer; var Value: WideString);
begin
Value := Format('%dR%dC', [ARow, ACol]);
end;
begin
Value := Format('%dR%dC', [ARow, ACol]);
end;
This code shows a Excel like Row/Column numbering handy for testing.
3) add some (4) rows to the Grid
CODE
NextGrid1.AddRow(4);
And you'll see RxCy text will be displayed without setting a cell's content as must be done for normal columns.