Parameters tnColIndex
Local lnCol, lnCurrOrder, lnColnmbr, lcCol2Focus
Local lnColToFocus
lnCol = 1
* tnColIndex
*!* 0 Up arrow on vertical scroll bar.
*!* 1 Down arrow on vertical scroll bar.
*!* 2 Vertical scroll bar in area above the scroll box.
*!* 3 Vertical scroll bar in area below the scroll box / right arrow
*!* 4 Left arrow on horizontal scroll bar.
*!* 5 Right arrow on horizontal scroll bar.
*!* 6 Horizontal scroll bar in area to the left of the scroll box.
*!* 7 Horizontal scroll bar in area to the right of the scroll box.
lnColNmbr = 0
lnCol = This.ActiveColumn
lnColToFocus = 0
If lnCol > 0
For lnColNmbr = 1 To This.ColumnCount
If This.Columns( m.lnColNmbr ).ColumnOrder = m.lnCol
lnColToFocus = m.lnColNmbr
Exit
Endif
Endfor
Endif
* Code from Vlad Grynchyshyn
* to be downloaded at UT - FAQ 8151
* Check if we do not need to set focus to the last column in grid
* This will happen when we did not focused column explicitly by
* mouse and pressed either Shift+TAB, left arrow key or Ctrl+left
* arrow key. In the last condition we check if column focused is
* the locked column. When you have 2 columns, you should check for
* both (for example,
* "AND (m.lnColToFocus = 1 OR m.lnColToFocus = 2)")
ThisForm.Lockscreen = .t.
If Not Mdown() And Inlist(Lastkey(), 15, 19, 26) And (m.lnColToFocus = 1)
This.Columns(This.ColumnCount).SetFocus
m.lnColToFocus = This.ColumnCount
Endif
Do Case
Case This.FreezeColumn > 1
m.lnCurrOrder = This.Columns(1).ColumnOrder
If This.Columns(1).ColumnOrder < This.LeftColumn && we scroll forward
For lnColNmbr = m.lnCurrOrder To This.LeftColumn - 1
This.Columns(2).ColumnOrder = This.Columns(2).ColumnOrder + 1
Endfor
For lnColNmbr = m.lnCurrOrder To This.LeftColumn - 1
This.Columns(1).ColumnOrder = This.Columns(1).ColumnOrder + 1
Endfor
ELSE && we scroll backward
For lnColNmbr = This.LeftColumn + 1 To m.lnCurrOrder
This.Columns(1).ColumnOrder = This.Columns(1).ColumnOrder - 1
Endfor
For lnColNmbr = This.LeftColumn + 1 To m.lnCurrOrder
This.Columns(2).ColumnOrder = This.Columns(2).ColumnOrder - 1
Endfor
Endif
OTHERWISE && This.FreezeColumn =< 1
m.lnCurrOrder = This.Columns(1).ColumnOrder
If This.Columns(1).ColumnOrder < This.LeftColumn && we scroll forward
For lnColNmbr = m.lnCurrOrder To This.LeftColumn - 1
This.Columns(2).ColumnOrder = This.Columns(2).ColumnOrder + 1
Endfor
For lnColNmbr = m.lnCurrOrder To This.LeftColumn - 1
This.Columns(1).ColumnOrder = This.Columns(1).ColumnOrder + 1
Endfor
ELSE && we scroll backward
For lnColNmbr = This.LeftColumn + 1 To m.lnCurrOrder
This.Columns(1).ColumnOrder = This.Columns(1).ColumnOrder - 1
Endfor
For lnColNmbr = This.LeftColumn + 1 To m.lnCurrOrder
This.Columns(2).ColumnOrder = This.Columns(2).ColumnOrder - 1
Endfor
Endif
Endcase
ThisForm.Lockscreen = .F.