>Something has bothered me for awhile, and finally I decided to post. I have a grid on a container. As I tab through the columns of the grid, my grid1.columnx.text1.when clauses are honored. But it seems like mouse clicks are not totally honored. If I mouse click into a column whose WHEN returns .F., it appears that the columns gets focus (the blue outline box borders the cell), but I can not edit the column data. It is like half the WHEN is honored.
>
>Has anyone else experienced this and have any insights? It causes me trouble when I ADD or SAVE from the toolbar. I go back to the row to validate the entries and I fire the grid1.columnx.text1.valid, yet it should not even have the focus. I end up displaying inappropriate errormessages.
>
>Any ideas?
>
>Brenda
Because of the problem you mentioned, plus the addition problem of arrowing up or down into a cell that has been WHENed off, I don't use the When Event to stop a control from receiving the focus. I use the GotFocus. Something like this:
PROCEDURE GotFocus
IF NOT This.ShouldGetFocus()
This.Parent.Parent.FocusElseWhere()
* Code in the Grid uses the ActiveRow, ActiveColumn, and properties like
* WasRow, WasColumn that were set in the Grid's BeforeRowColChange(), to
* determine the direction the user was navigating. FocusElseWhere then
* does a ActivateCell(RowToGoTo, ColumnToGoTo) to the next cell that can
* receive the focus.
ENDIF
This code took me quite a while to get right, so you my want to use a simpler approach as time permits. When the user picks Save from the toolbar, you might just see if the active control is in a grid, and if so run the ShouldGetFocus() to see if the valid is necessary. Just some ideas to ponder.
Charlie