Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid Method and Cancel Button
Message
De
20/07/1999 15:02:58
 
 
À
20/07/1999 14:58:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00243647
Message ID:
00243722
Vues:
26
>Jeff ---
>
>Here is the text of the FAW I wrote (sorry, wasn't KB).
>---------------------------------------------------------------------
>A common problem is that Valid always fires, regardless of the actual status of the add or edit. Logically, if an edit is being cancelled, you do not want to enforce validation.
>
>There is a way to do it. If involves using some old (but still supported) Fox commands:
>LOCAL nCancelTop,nCancelHeight,nCancelLeft,nCancelWidth
>nCancelTop=THISFORM.cmdCancel.Top
>nCancelBottom=nCancelTop+THISFORM.cmdCancel.Height
>nCancelLeft=THISFORM.cmdCancel.Left
>nCancelRight=nCancelLeft+THISFORM.cmdCancel.Width
>IF BETWEEN(MROW("MyForm",3),nCancelTop,nCancelBottom) AND ;
>     BETWEEN(MCOL("MyForm",3),nCancelLeft,nCancelRight) AND ;
>     MDOWN()
>   RETURN .T.
>ENDIF
>
>What this code does is look for the "cancel" button and test the mouses position and "button down" status to see if the cancel button is being clicked. If it is, Valid returns True and the control can be left without validation. To use this code, substitute your form's name for MyForm and your cancel buttons name for THISFORM.cmdCancel.
>
>You could actually block several controls from validation by just reiterating this code for every control that you want to skip validation on.
>---------------------------
>HTH
>John

Can you use the SYS(1270) to determine what object you are over?

Dan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform