Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking for a snazzy way
Message
From
13/08/2001 07:11:17
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00534851
Message ID:
00542905
Views:
11
Thanks Mark - I will give it a go.

Been on holiday.. sorry for the delayed response

Will

>Install VFP7 and you can run those 4 lines of code in 1 line of code with the EXECScript() function. < g >
>
>If your 1 line solution works that is great. However, I think that 1 line solution produces a mask that is 8 places wide when there are no decimals, and 9 places wide when there is a decimal. If that is your intent, cool. However, this 4-line solution always returns the same number of places. When you can put such code in the INIT of your class, IMHO, the number of lines of code should take a back seat to functionality.
>
>I would add 2 properties to the textbox or form class, nDecimals, nMask. Then the INIT code looks like:
>local lnSetDec, lnWidth, lnMask, lnDec
>lnSetDec = set('decimals')
>lnMask   = This.nMask       && or ThisForm.nMask
>lnDec    = This.nDecimals   && or ThisForm.nDecimals
>lnWidth  = len(transform(lcMask))
>set decimals to lnDec
>This.InputMask = RIGHT(TRANSFORM(lnMask/INT(10**(lnDec-1)), '@T'), lnWidth)
>set decimals to lnSetDec
>Now you have a reusable class that is quite generic.
Will Jones
Previous
Reply
Map
View

Click here to load this message in the networking platform