Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Grid Cell index value
Wed, Sep 23 2015 9:03 PMPermanent Link

PhillipH

My testing seems to indicate the Index value is the index of the visible cells. If this is correct, is there a way to relate this back to a row number ?
e.g. I would like to colour a cell but as its colour would depend a value not in the current cell I need a reference that I can use to look up some external data. Note: My grids are unbound.

Phillip
Thu, Sep 24 2015 9:16 AMPermanent Link

Trinione

PhillipH wrote:

<< My testing seems to indicate the Index value is the index of the visible cells. If this is correct, is there a way to  relate this back to a row number ? >>

Not sure if this is what you are looking for. grdName.Rows[RowIndex][ColumnIndex]

<< g. I would like to colour a cell but as its colour would depend a value not in the current cell I need a reference that I can use to look up some external data. Note: My grids are unbound. >>

Again, not sure but maybe this would help guide you along:

var
 col: TGridColumn;           
 cel: TGridCell;

begin                             
   col := grdCalendar.NewColumn;

   case i of
     0:
       col.OnCellUpdate := GridColumn1CellUpdate;
     1:

procedure TfrmForm1.GridColumn1CellUpdate(Sender: TObject; ACell: TGridCell);
begin
 SetupCell(ACell);
end;

procedure TfrmForm1.SetupCell(ACell: TGridCell);
begin
 ACell.Background.Fill.Color := clWhiteSmoke;
end;
Thu, Sep 24 2015 12:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Phillip,

<< My testing seems to indicate the Index value is the index of the visible cells. If this is correct, is there a way to relate this back to a row number ? >>

Yes, that is correct.  Unfortunately, what you want is the *protected* TGrid.RowOffset property.  I'll see if I can expose this data in a more rational way for the TGridCell instance, something like a RowIndex property that does the calculations for you.

Tim Young
Elevate Software
www.elevatesoft.com
Image