Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force one form to deactivate/lose focus
Message
De
25/03/2024 06:11:15
 
 
À
21/03/2024 10:29:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01687751
Message ID:
01687770
Vues:
48
J'aime (1)
>I have a pair of forms that are related (in a parent/child kind of way). There's code in my framework so that if I move the record pointer in the parent form, the child form moves to the corresponding record. That's all working.
>
>This application allows only one form to be in edit mode at a time, so there's framework code in the main data entry form class's Deactivate method that checks whether the form being deactivated is in edit mode and if so, prompts the user to either cancel the edit or stay on the current form.
>
>What I'm working on now is having a textbox on each form where the user can scan a barcode and it will position the parent form on the record indicated by the barcode and then open or position the child form on the corresponding record in edit mode. That is, if the child form is not open, open it; otherwise, just reposition. But in either case, switch to edit mode.
>
>The scan textbox on the parent form is working as I need it to, but the one on the child form is resulting in that message about having to either cancel the edit or stay put. What's happening is that to do what we need, we have to refresh the parent form (which then allows us to update the child form using a custom method).
>
>The problem is that having done so, the parent form has focus, and I can't find a way to force it to deactivate and hand focus over to the child form before I switch the child form into edit mode. I've tried using ACTIVATE WINDOW and setting focus to a control on the child form and doing both, and I still see that the parent form's Deactivate method doesn't fire until after the code that changes the child form's mode.
>
>So I'm looking for a surefire way to have the parent form's deactivate run when I want it to (other than closing the parent form). Any ideas?
>

Someone in another forum suggested just avoiding having the code that's causing the trouble fire, and I realized I could add a flag to the form class, set it at the beginning of this particular process and clear it at the end, and wrap the call in Deactivate with a test of the flag. Did that and now it works as needed.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform