Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Data Grid, Index of column selected
Tue, Sep 1 2015 6:18 AMPermanent Link

Trinione

For example, the user clicks on the first column, how can I get the Index value of 0?
Tue, Sep 1 2015 7:25 AMPermanent Link

Walter Matte

Tactical Business Corporation

Trinione wrote:

For example, the user clicks on the first column, how can I get the Index value of 0?

This should work - but I think there is a bug in 2.01 B2 - as this fails and should work.....

ShowMessage('Row: ' + IntTostr(grdFind.RowIndex) + ' ' +
             'Col: ' + Inttostr(grdFind.ColumnIndex) + ' ' +
             'Value: ' + grdFind.Rows.Row[grdFind.RowIndex].Value[grdFind.ColumnIndex]);

//  This works too.
showmessage(grdFind.Rows[grdFind.RowIndex][grdFind.ColumnIndex]);


Walter
Tue, Sep 1 2015 7:41 AMPermanent Link

Trinione

<< This should work - but I think there is a bug in 2.01 B2 - as this fails and should work...
showmessage(grdFind.Rows[grdFind.RowIndex][grdFind.ColumnIndex]); >>

Yes, I also tried grd.ColumnIndex and it did not work. Must be a bug.

Tim, can you confirm please? Bug? Fix?
Wed, Sep 2 2015 10:33 AMPermanent Link

Trinione

Tim:
The following works to show the selected Row:
ShowMessage(IntToStr(Grid1.RowIndex));

However, the following does not work to show the selected Column:
ShowMessage(IntToStr(Grid1.ColumnIndex));

???
Wed, Sep 2 2015 3:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Tim, can you confirm please? Bug? Fix? >>

Note: sometimes I'm a little swamped, so you'll have to be patient while I address other things.  This is especially true after a big minor release.  Please don't keep posting the same question, or re-sending it as an incident report.

As to the issue:  you can't reference the Rows property with a *bound* grid.  The Rows property is where rows are stored for an un-bound grid.

As to the RowIndex/ColumnIndex: it would help if someone would post the *context* in which they're seeing this issue.  I've tried referencing both properties in both the OnClick and OnDblClick event handlers for a grid, and they always work just fine (if they didn't, then the grid "painting" wouldn't work properly).  So, I need to know what is calling the code that is being posted, and how it's being called.  A sample project that reproduces the problem would be even better.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 2 2015 3:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< However, the following does not work to show the selected Column:
ShowMessage(IntToStr(Grid1.ColumnIndex)); >>

What do you mean by "it doesn't work" ?????  Please be specific when you report an issue.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Sep 2 2015 4:32 PMPermanent Link

Trinione

<< Note: sometimes I'm a little swamped, so you'll have to be patient while I address other things.  This is especially true after a big minor release.  Please don't keep posting the same question, or re-sending it as an incident report. >>

Tim,
As I stated on the Incident Report, I only discovered today. However, as one cannot delete comments on this forum I was unable to remove my comment.

.....
Your suggestion was indeed the case. RowSelect = True was the problem.

ColumIndex works as expected when it is set to RowSelect = False.

Thank you, much appreciated.
Image