>I have a Grid with full row selection. I want to run some code when the user clicks on a row or uses the keyboard up/down arrows.
>
>If I run the code in the AfterRowColChange Event it does not fire if the user clicks on the first row. I can also trigger the code in the Click method but I do not want it to run twice.
>
>I thought maybe I could use this code in the Click but RowColChange is always 0 in the click:
>
>IF this.RowColChange= 0
> this.AfterRowColChange()
>ENDIF
Patrick
Off the top of my head:
You say the method doesn't fire ONLY when you click on row 1 (and presumably the first time you actually set focus on the grid)?
If that's the case, and I assume the AfterRowColChange event calls some form method, as per good practice, the Click() event could test for a form prop flag = .T. (e.g. thisform.lFirstTime), and do the form method only if .T., clearing the flag to .F.
Click Event:
With thisform
If .lFirstTime
.lmRowColChangeEvent()
.lFirstTime = .F.
EndIf
EndWith
AfterRowColChange event:
Thisform.lmRowColChangeEvent()
HTH
Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.