Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
Odd behavior activating cells
posted

Hi, all -

 We have a number of bands in our grid and not every cell "does something" - some are just for show.  So I am writing a custom KeyDown handler for the grid where it looks for Tab (or shift-Tab) and figures out which is the next cell to move to based on what's expanded and what exists.  Then at the end of the "which cell are we gonna move to" block, there's a single block to activate the cell, which looks like:

            If newRow IsNot Nothing Then
                _MapGrid.ActiveRow = newRow
                newRow.Cells(Col).Activate()
                ' _MapGrid.ActiveCell = newRow.Cells(Col)

                If newRow.Cells(Col).CanEnterEditMode Then _MapGrid.PerformAction(UltraGridAction.EnterEditMode)
                e.Handled = True
                e.SuppressKeyPress = True
                System.Diagnostics.Debug.WriteLine("After tab: New cell is " & Col & " and activated is " & newRow.Cells(Col).Activated)
            End If

"newRow" is the row we've decided to move to (either forward OR backward) and "Col" is a string containing the name of the column to activate. Forward-tabbing works fine and will find and activate the correct cell when moving from one row to the next, or one band to the next.

Shift-tabbing does not. For whatever reason, the "newRow.Cells(Col).Activate" call isn't "sticking."  I can put a breakpoint immediately after it and check the active status of the cell, and it will still report "False." I also tried assigning _MapGrid.ActiveCell (its commented out in the sample above.)

 So, my questions are:

1) What on earth would make this work when tabbing in one direction but not the other? How can I make it stop doing this?

2) What (also on earth) would keep the ".Activate" call from not taking effect? and of course

3) How do I fix it? ;)

 Interestingly, I've seen similar ignoring of a call happen when trying to expand parent bands - I'll call "ExpandAll" and it will simply ignore it, leaving the branch collapsed.

 Thanks a bunch,

Rob

Parents Reply Children