budgie
2006-11-20 03:51:09 UTC
I have a form which contains a number of controls plus an array of 64 text
boxes. The "rules" controlling the text box data entry require that cells with
data must be "left-packed" in the array, and data entry can only take place in
an occupied cell OR the first vacant cell after the contiguous block of occupied
cells. To illustrate, if cells 0-6 contain data, data entry can only take place
in cells 0-7.
To enforce this last condition, I use a Got_Focus event and check that the cell
to the left is not vacant. If it is, I back up one cell to the left (and check
again). By this means, attempts to locate the focus to invalid locations are
defeated.
Movement within the array can result from: (a) direction arrow keys; (b) Tab
key; (c) mouse selection; or (d) Enter key. To process data entry, target cell
highlight and movement, I use Key_Press, Key_Up, Lost_Focus and Got_Focus
events.
Everything works fine *EXCEPT* that the user can't Tab outside the data entry
cells (0-7 in the example) and therefore cannot access the form's controls using
the Tab key, which isn't acceptable. I'd like the tabbing to cell 8 to result
in focus moving off the textbox array and to the first control in tab order,
rather than generating a "backup" to cell 7. Try as I might, I can't seem to
find a way to determine HOW the focus arrives at (say) cell 8 in the example.
The fact that Tab key movement is by VB and not my code doesn't help. I have
even contemplated disabling tabstop on all "invalid" cells (8-63) on the fly,
but that looks to be messy.
Any suggestions how I can determine the "history" before a Got_Focus arrival
detection so I can discriminate between the different means of arrival ?
boxes. The "rules" controlling the text box data entry require that cells with
data must be "left-packed" in the array, and data entry can only take place in
an occupied cell OR the first vacant cell after the contiguous block of occupied
cells. To illustrate, if cells 0-6 contain data, data entry can only take place
in cells 0-7.
To enforce this last condition, I use a Got_Focus event and check that the cell
to the left is not vacant. If it is, I back up one cell to the left (and check
again). By this means, attempts to locate the focus to invalid locations are
defeated.
Movement within the array can result from: (a) direction arrow keys; (b) Tab
key; (c) mouse selection; or (d) Enter key. To process data entry, target cell
highlight and movement, I use Key_Press, Key_Up, Lost_Focus and Got_Focus
events.
Everything works fine *EXCEPT* that the user can't Tab outside the data entry
cells (0-7 in the example) and therefore cannot access the form's controls using
the Tab key, which isn't acceptable. I'd like the tabbing to cell 8 to result
in focus moving off the textbox array and to the first control in tab order,
rather than generating a "backup" to cell 7. Try as I might, I can't seem to
find a way to determine HOW the focus arrives at (say) cell 8 in the example.
The fact that Tab key movement is by VB and not my code doesn't help. I have
even contemplated disabling tabstop on all "invalid" cells (8-63) on the fly,
but that looks to be messy.
Any suggestions how I can determine the "history" before a Got_Focus arrival
detection so I can discriminate between the different means of arrival ?