I have a situation involving three columns in a grid. Because I am not feeling creative lets call them 1, 2, and 3. :-)
At the beginning of the flow, a cell in column 1 is active, column 2 is hidden, and column 3 is visible and enabled.
If I make a change to column 1 that will cause column 2 to "unhide" and tab out, column 2 appears, but the active cell moves to column 3. It appears that at the time of the tab press, the destination column is already determined. It makes sense...the grid has no way of knowing that column 2 is about to be available.
However, I would really like the active cell to land on column 2.
Can you suggest a good mechanism to make this happen? I have something that works, but I don't think it is the most elegant solution...and I have to assume this is a pretty common issue.
Thank You!
Darin
Originally I believe I was using InitializeRow...but a variant of the approach you suggested is what I had landed upon. In BeforePerformAction I set a flag which I picked up in the BeforeCellActivate method and redirected to the newly visible column. I like the idea of going there directly a bit better so I will experiment with that.
Thank you for the confirmation that I was on the right track and the advice.
Hi Darin,
What event are you using to show the hidden column?
My suggestion would be to try handling this in the BeforePerformAction method. Assuming the user is pressing the Tab key to move from cell 1 to cell 3 and you want to redirect them to cell 2, instead, you could use BeforePerformAction to trap for the NextCellByTab action. Assuming that you can detect that column 2 will soon become visible, you could cancel the action, and then set focus to cell 2. Of course, there's a timing issue because the column will not yet be visible, so you might have to use a BeginInvoke.