Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can exit loop when called directly but not from menu
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00975330
Message ID:
00975448
Vues:
15
>The upshot is that I think this is a VFP problem rather than something with your code. I know it doesn't help much, but perhaps you could think up an alternate solution.
>

I'm beginning to think this is some kind of scoping problem.

I tried an alternate solution--using a button on the form to cancel instead of the escape key. Doing this meant I couldn't use a local variable anymore, so I created a form property called lXit. The click of the button just had thisform.lXit = .T.

Most of the time the loop is processing, it's running a method in my application object, i.e. it's outside the form. When I used the button, the behavior changed from ignoring the Escape or hanging to giving and error saying "Thisform can only be used within a method..." (I don't remember the exact wording of the error, but you know the one I mean.)

"Ah ha!", I thought. When I run the form directly, I instantiate the application object in the Load of the form, whereas when I call it from my program, I instantiate the application from the program before calling the form. But then why did the local variable work? When I double-checked, I discovered that in my experimenting, I neglected to declare the variable local, therefore it was private.

So I figured the solution to this is to create an application property instead. I've done that....but the behavior is worse! It works fine when I run the form directly, but when calling from my program, it hangs without having to press escape or the cancel button.

I still believe this is a scoping issue, but the solution escapes me. (Pun intended.)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform