Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 9 of 9 total |
TGrid ColumnIndex Returning Wrong Index |
Wed, Feb 14 2018 9:12 PM | Permanent Link |
Frederick Chin | I have a TGrid with 3 TGridColumns (A, B and C). Their Index properties are 0, 1 and 2 respectively. B's Visible property is False.
When the project is run, I see A and C. If my cursor is in A, the following code Grid1.ColumnIndex returns 0. If my cursor is in C, the same code returns 1. I would have expected 2. How do I get the correct column's property since I want to know the DataColumn property of the column the cursor is at? -- Frederick |
Thu, Feb 15 2018 4:27 AM | Permanent Link |
Matthew Jones | Frederick Chin wrote:
> ColumnIndex You said that they had an Index value, and the Grid.Columns[Grid.ColumnIndex].Index would presumably be what you seek? What value does it have? -- Matthew Jones |
Thu, Feb 15 2018 8:42 AM | Permanent Link |
Frederick Chin | "Matthew Jones" wrote:
/* You said that they had an Index value, and the Grid.Columns[Grid.ColumnIndex].Index would presumably be what you seek? What value does it have? */ In design mode, the index values for columns A, B and C are 0, 1 and 2 respectively. Since column B is hidden, I would have expected the index shown for column C to be 2 during runtime. Instead, it is showing 1 for the index; the hidden column. The cursor is currently sitting under column C. Because of this anomaly, I cannot retrieve the DataColumn property for column C because the index pointed to is for column B. -- Frederick |
Thu, Feb 15 2018 9:13 AM | Permanent Link |
Matthew Jones | Frederick Chin wrote:
> In design mode, the index values for columns A, B and C are 0, 1 and 2 respectively. Since column B is hidden, I would have expected the index shown for column C to be 2 during runtime. > > Instead, it is showing 1 for the index; the hidden column. > > The cursor is currently sitting under column C. Because of this anomaly, I cannot retrieve the DataColumn property for column C because the index pointed to is for column B. I am not sure if you have tried what I suggested? The column object has an Index property, and that is different to the ColumnIndex which is obviously based on the visible columns. But if you use the ColumnIndex to access the column, what does the Index value hold? -- Matthew Jones |
Thu, Feb 15 2018 9:36 AM | Permanent Link |
Frederick Chin | "Matthew Jones" wrote:
/* I am not sure if you have tried what I suggested? The column object has an Index property, and that is different to the ColumnIndex which is obviously based on the visible columns. But if you use the ColumnIndex to access the column, what does the Index value hold? */ 1. -- Frederick |
Thu, Feb 15 2018 12:37 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Frederick,
<< I have a TGrid with 3 TGridColumns (A, B and C). Their Index properties are 0, 1 and 2 respectively. B's Visible property is False. When the project is run, I see A and C. If my cursor is in A, the following code Grid1.ColumnIndex returns 0. If my cursor is in C, the same code returns 1. I would have expected 2. >> The ColumnIndex property reflects visibility of the columns. Use with the VisibleColumns and VisibleColumnCount properties to navigate the visible columns, and theColumns and ColumnCount properties to navigate all columns, irrespective of their visibility. Tim Young Elevate Software www.elevatesoft.com |
Thu, Feb 15 2018 1:43 PM | Permanent Link |
Matthew Jones | Frederick Chin wrote:
> 1. Okay, definite issue for Tim then. -- Matthew Jones |
Mon, Feb 19 2018 5:26 PM | Permanent Link |
Frederick Chin | Tim,
/* The ColumnIndex property reflects visibility of the columns. Use with the VisibleColumns and VisibleColumnCount properties to navigate the visible columns, and theColumns and ColumnCount properties to navigate all columns, irrespective of their visibility. */ Thanks. Changing from TGrid.Columns[TGrid.ColumnIndex].DataColumn to TGrid.VisibleColumns[TGrid.ColumnIndex].DataColumn gave me the column name the cursor is at. -- Frederick |
Thu, Feb 22 2018 3:41 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Frederick,
<< Changing from TGrid.Columns[TGrid.ColumnIndex].DataColumn to TGrid.VisibleColumns[TGrid.ColumnIndex].DataColumn gave me the column name the cursor is at. >> For the record, the reason for the naming weirdness was that the Visible* properties were added later and I didn't want to introduce a breaking change. Ideally, the ColumnIndex property would reflect the column index, and the VisibleColumnIndex property would reflect the visible column index. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, December 1, 2024 at 03:59 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |