Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form/Messagebox call in Valid kills Click
Message
De
17/12/2019 07:43:15
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
16/12/2019 14:55:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01672274
Message ID:
01672281
Vues:
97
>Running into something weird that I haven't encountered before, but maybe I just haven't run into this situation. I have code called by a textbox's Valid method that pops up a form to ask the user to make a choice. If the user clicks a button while focus is on the textbox, the form pops up as expected, but then while focus lands on the button, the Click method doesn't fire.
>
>A few things I've done to track this down:
>
>1) I've created a much simpler form to test with and confirmed that I see the problem there as well.
>2) I've used Event Tracking and I see that the button's MouseDown fires, but not MouseUp or Click.
>3) I've also tried replacing the form call with a call to MessageBox() to confirm that it's not something about my form that's causing this problem. Same issue.
>4) I've tested using only the keyboard in the pop-up form or messagebox, not the mouse, and it doesn't make a difference.
>
>So is this a known issue that I've just been lucky enough not to encounter before?
>
>Any thoughts about how to work around it? I'm thinking that I'll need to set a property in the textbox Valid before calling the pop-up and then in GotFocus of every button on the form, check that property and, if it's set, do something to fire the Click code and clear the property. I'll need a way to clear the property in cases when we're leaving the textbox and headed anywhere other than a button. That one is trickier, but it looks like the button's When fires before the textbox's LostFocus, so maybe a second property to indicate that we're headed for the button.
>
>That all sounds really ugly, so if anyone has other ideas, I'd love to hear them.

Could this be the sideeffect of the limitation of .valid(), .when() and the two spinner events, from which you can't call anything that shifts focus? Launching a form (or messagebox) makes the whole form to lose focus, but it's not an explicit .setfocus() to anything, so the runtime doesn't catch it as an error. But I'd guess instead of an error you get weird behavior like this.
So perhaps you just move the code from valid into something else, even into a one-time 5ms delayed timer?

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform