Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Displaying calculated field in a form
Message
De
12/08/2005 14:28:50
 
 
À
12/08/2005 13:50:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01040587
Message ID:
01040603
Vues:
12
If you are wanting to simply calculate a weight and display it in a form, then use the INIT method to calculate the weight and assign to the display object. Also, I assume you would want to pass some parameters to the form in order to offer different calculations.

PROCEDURE Init
LPARAMETERS pnUseSize, pnBlunt
IF VARTYPE(pnUseSize) != "N" .OR. VARTYPE(pnBlunt) != 'N'
WAIT WINDOW "Invalid parameters for weight calculation"
RETURN .F.
ELSE
<>.CalcWeight.value = pnUseSize * pnUseSize * pnBlunt * 0.222
ENDIF
ENDPROC


Note that the value above, <>, must be the parent of the CalcWeight object. If the CalcWeight object is located directly onto a form, then use "thisform" for <> (no quotes); if the CalcWeight object is located, say on a pageframe, page1, then use "thisform.pageframe1.page1" for <> (again no quotes).

The above example is called by:

lnUseSize = 10.0 && This is set by whatever algorithim in your code
lnBlunt = 9.0 && This is set by whatever algorithim in your code
DO FORM MyFormName WITH lnUseSize, lnBlunt

I am testing that numeric values were passed to the form; if not, then the form will exit without displaying (caused by the RETURN .F. statement).

Hope this helps.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform