Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Commandbutton Click Doesn't Fire After Textbox Validatio
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00786042
Message ID:
00786372
Vues:
19
>I tried this on VFP 6 (SP5), 7 and 8.
>
>Create a new form, add a textbox and a commandbutton. In the Valid() event of the textbox put:
>
> IF .t.
> WAIT WINDOW 'Hello'
> ENDIF
>
>In the Click() even of the commandbutton put:
>
> WAIT WINDOW "Did Command"
>
>Now run the form, be sure the cursor is in the textbox, and then click on the commandbutton.
>
>You should get the wait window showing the "Hello" message, but the commandbutton's Click() event doesn't fire. The "Did Command" message never shows. But the command button does receive the focus. (Clicking it again runs the Click() code as expected - but you have to click it twice to get it to work properly.)
>
>I need to show a validation message when the user leaves the textbox and one of the ways the user can leave the textbox is by clicking on a commmand button. When a user clicks on the commandbutton, the message shows up but the command button's code is never executed.


If you change the WAIT WINDOW in the Valid to be WAIT WINDOW "your message" NOWAIT NOCLEAR the Click fires just fine. You will need to do a WAIT CLEAR to get rid of the message.



>I need to be able to detect when the button is clicked but none of the commmandbutton events seem to fire before the textbox's valid event and after I only can get a GotFocus() event on the commandbutton. But I don't know if the commandbutton was reached by a tab-through or a mouse-click.

You could have a flag property that you set in the MouseDown event and check if that property is set in the Click (clearing it also).
*Init
this.AddProperty("MouseUsed")

*MouseDown
this.MouseUsed = .t.

*Click
IF this.MouseUsed()
  this.MouseUsed = .f.
  *
  * Do whatyou need to do if clicked by the mouse
  *
ENDIF
Or you just could use the MDOWN() function.
IF MDOWN()
  *
  * Do whatyou need to do if clicked by the mouse
  *
ENDIF
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform