Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5: for Critical Analysis: Input mask in a textbox
Message
 
À
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:
00774640
Vues:
19
Hi

I have seperated the currecny class now thanks.

PART I
Sorry to have troubled you all. But there was a major misunderstanding on my part. There are two InputMask properties for a column
1. Properties | Data | InputMask
2. Properties | Layout | DynamicInputMask

I used DynamicInputMask which was wrong, using the InputMask on the Data tab did the trick.

Thanks for your patient responses.


PART II
Now I did the same thing programatically, ie. setting of the columns InputMask property. Though the gotfocus() of the textbox shows that the column has the InputMask property set correctly, it still shows the currency placements of 4 decimals.


PART III
More interestingly, the gotfocus() of the textbox when wait window this.parent.inputmask shows the mask I have programatically set but in actual it uses the input mask that is specified at design time, which, to differentiate, I had set to 9,9,9,9,9.9

>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.
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform