Jump to content


Photo

Virtual Columns


  • Please log in to reply
No replies to this topic

#1 wvd_vegt

wvd_vegt

    Master Member

  • Honorable Members
  • PipPipPipPipPip
  • 710 posts
  • Gender:Male
  • Location:the Netherlands

Posted 09 May 2005 - 10:45 PM

Hi,

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;



  ...


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;


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.
G.W. van der Vegt




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users