Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid - AfterRowColChange or Click
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01103964
Message ID:
01104058
Views:
66
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform