TStringGrid focus issue
Original Reporter info from Mantis: igoddard
-
Reporter name: Ian Goddard
Original Reporter info from Mantis: igoddard
- Reporter name: Ian Goddard
Description:
There exists a condition in which the grid has focus but no cell has an explicit focus. Nevertheless a cell does have an implicit focus.
One instance is when the grid is first displayed and has the lowest tab order value or when it has been tabbed to from another control. If the user has previously had the cursor on a specific cell of the grid and tabs back from another control then that cell receives the implicit focus, otherwise it goes to the first cell.
Another is when the user is navigating the grid by tab, has reached the last tabbable cell and presses tab again. If there is another control to which focus can pass then it will do so, otherwise the focus remains on the grid, the last cell visited loses explicit focus but retains implicit focus.
In each case each successive key press will overwrite the contents of the cell with the implied focus.
If the cell is empty the subsequent behaviour looks odd but is harmless. If the user tries to type in a series of characters the cell simply displays a single character, replacing it each time the key is pressed.
If, however, the user has already entered data in the cell this data will be overwritten by the next key press. The user would probably not consider this behaviour harmless. There is no visual feedback to the user to indicate that the cell contents are vulnerable in this way.
There a three alternatives to minimise the impact of this.
-
The situation left as it is at present but with the contents at risk highlighted.
-
The cell should have explicit focus and behave appropriately. If the cell has already had data entered the cursor should returned be at its last known position if that's possible.
-
If no cell has explicit focus any keys other then navigation keys should be ignored.
Mantis conversion info:
- Mantis ID: 23661
- Version: 1.0.4