Antony R.
2016-04-24T19:57:43Z
Hi,
In Access there is a property for every control named "Tab Stop" /Boolean
It is obvious that when is set to false, tab key jumps over the control and stops to the next one with the tab stop property set to true.
This is very useful when there are controls that you only want to use rarely or only by mouse.

In igrid, it could be implemented by setting CellSelectable to false and turn it temporary back to true on click event.
But then you lose multiselection on these cells!
Another approach is to leave the cells selectable and trap keydown to change the behavior of tab key but then a problem surface when you press tab after editing a cell.
In this case no key is trapped in keydown event.
So the focus moves to the next selectable cell.

I have three columns, one requires edit rapidly, one needs edit rarely (with click) and the other one should be multi-selectable.

Is there any other approach that tab would move only through the rapidly edited column?


Igor/10Tec
2016-04-25T07:32:09Z
The TAB key is a special control key and you can't reprogram it this way. I see no easy way to implement this specific task in iGrid except what you wrote.
Antony R.
2016-04-25T12:08:29Z
Originally Posted by: Igor/10Tec 

The TAB key is a special control key and you can't reprogram it this way. I see no easy way to implement this specific task in iGrid except what you wrote.



It doesn't have to be tab key. Enter would be ok also...
But enter doesn't move the focus in igrid. (thats why I tryied to use tab key)
First enter is used for ending editing mode and you can't catch it in keydown event.
So you must press two enters to handle the second one and move in the proper cell that you want.

The task is simple but is also basic!
As in excel you enter cells in a column pressing :
1, Enter
2, Enter
3, Enter

The only way here to do this simple task is by pressing enter twice (and write code to handle the second one) or have only one column enabled and press tab?



Igor/10Tec
2016-04-25T14:12:00Z
If we can use ENTER, the solution is the following:

Private m_bNextCell As Boolean

Private Sub iGrid0_TextEditKeyDown(ByVal lRow As Long, ByVal lCol As Long, ByVal KeyCode As Integer, ByVal Shift As Integer)
   If KeyCode = vbKeyReturn Then
      m_bNextCell = True
   End If
End Sub

Private Sub iGrid0_KeyUp(KeyCode As Integer, Shift As Integer)
   If m_bNextCell Then
      If iGrid0.CurRow < iGrid0.RowCount Then
         iGrid0.SetCurCell iGrid0.CurRow + 1, iGrid0.CurCol
         iGrid0.RequestEditCurCell
      End If
      m_bNextCell = False
   End If
End Sub
Antony R.
2016-04-26T06:49:47Z
Originally Posted by: Igor/10Tec 

If we can use ENTER, the solution is the following:

Private m_bNextCell As Boolean

Private Sub iGrid0_TextEditKeyDown(ByVal lRow As Long, ByVal lCol As Long, ByVal KeyCode As Integer, ByVal Shift As Integer)
   If KeyCode = vbKeyReturn Then
      m_bNextCell = True
   End If
End Sub

Private Sub iGrid0_KeyUp(KeyCode As Integer, Shift As Integer)
   If m_bNextCell Then
      If iGrid0.CurRow < iGrid0.RowCount Then
         iGrid0.SetCurCell iGrid0.CurRow + 1, iGrid0.CurCol
         iGrid0.RequestEditCurCell
      End If
      m_bNextCell = False
   End If
End Sub




It works like a charm!!!
Thanks!!!