Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5: for Critical Analysis: Input mask in a textbox
Message
De
03/04/2003 07:37:35
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00773410
Message ID:
00773475
Vues:
14
One thing you can do is create a class, "cCurrency", for currency textboxes. You can have a property, .nDecimals, to store the number of decimals you want. Have a method, .SetDecimals(), to set the decimals. (You can also use the assign method, nDecimals_Assign, if you have VFP 6 or later - in this case, just assigning a value to .nDecimals will execute the method.)
* Method SetDecimals
lparameters lnDecimals
do case
case lnDecimals = 3
  This.InputMask = "9,99,99,999.999"
...
endcase
Or perhaps you can find a generic expression for the above.

You could also have a method called .SetType(), which accepts a character parameter: "quantity", "rate", etc., and sets properties accordingly

HTH,

Hilmar.



>Hi all
>
>I have this idea that there are, IMO atleast, three types of business numeric value (please note the Indian comma system):
>
>1. Qty.           Input Mask: 9,99,99,999.999
>2. Rate           Input Mask: 99,99,999.9999
>3. Amount         Input Mask: 99,99,99,999.99
>
>
>I have this general concept that I would want to keep all of the above types of fields currency. As VFP does not have user-defined type of field mapping. Just one mapping each for currency, integer, etc.
>
>I have put in the following working logic in the init() of my textbox class associated with the currency.
>
>*** if currency or numeric, float, double, integer
>IF INLIST(TYPE("THIS.VALUE"), "Y", "N")
>	DO CASE
>		CASE "amount"$LOWER(THIS.COMMENT) OR "amt"$LOWER(THIS.COMMENT)
>			THIS.INPUTMASK = goApp.GetSetting("General", "Amount Format", "99,99,99,999.99")
>
>		CASE "quantity"$LOWER(THIS.COMMENT) OR "qty"$LOWER(THIS.COMMENT)
>			THIS.INPUTMASK = goApp.GetSetting("General", "Quantity Format", "9,99,99,999.999")
>
>		CASE "rate"$LOWER(THIS.COMMENT)
>			THIS.INPUTMASK = goApp.GetSetting("General", "Quantity Format", "99,99,999.9999")
>	ENDCASE
>ENDIF
>
>
>1. I know I can have different class for different type of numeric value, but VFP won't ease things if all the fields are currency (there are clients who will want more or less decimals, in special cases on-the-fly).
>
>2. I do not want to miss the fun of drag-n-drop (just recently promoted myself from DOS, so this is dream luxury for me).
>
>3. I have developed a builder to fill in the comment from the DBC field description, this is where I will originally put in the words rate, amt, qty weaved in the description.
>
>
>I will welcome any feedback and better options that are available from you all.
>
>Appreciating all the previous responses, I have now gathered more confidence in putting forward my views. Thank you, the VFP community as a whole, for sharing, sharing and still more sharing.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform