PRB: Disabled Grid Column Allows Focus with Mouse ClickID: Q135628 The information in this article applies to:
SYMPTOMSIf the Enabled property of a grid column is set to False (.F.), the insertion point is not allowed to enter the column if accessed from the keyboard. However, clicking the column moves the insertion point to the cell beneath the mouse pointer. Even though no changes can be made, this behavior may be perceived as confusing, and is inconsistent with other controls.
WORKAROUNDTo prevent the mouse click from activating a disabled column, check for the nColIndex in the AfterRowColChange event to determine if the column is one which should reject focus. If it is, reset focus back to the current cell by calling the ActivateCell method.
STATUSThis behavior is by design.
MORE INFORMATIONTo determine the last active cell, you need to ensure that the row and column values are stored as a property of the form. Create two new properties named OldRow and OldCol. To set the values, add the following lines of code to the GotFocus event for each object in the grid that should receive focus:
In the following example, the second column is disabled:
Now when clicked, the disabled column will flash briefly. Then focus will
return to the last active cell selected.
Additional reference words: 3.00 VFoxWin browse KBCategory: kbprg kbprb kbcode KBSubcategory: FxprgGrid |
Last Reviewed: August 25, 1995 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |