Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inputting numerics without commas but displaying them wi
Message
From
25/11/1998 11:42:26
 
 
To
25/11/1998 11:33:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00161392
Message ID:
00161420
Views:
23
>>>>Hello
>>>>
>>>>I have a user who wants to have numeric values displayed in 999,999.99 format but entered in 999999.99 format.
>>>>
>>>>Does anyone know how I can do this?
>>>You could create a textbox class with :* Gotfocus
>>>this.inputmask = "999999.99"
>>>*Lostfocus
>>>this.inputmask = "999,999.99"Cetin
>>
>>Sorry, in my rush to ask the question I forgot to mention that I need to do this in a textbox in a grid. In this case would I still change the inputmask setting on the textbox or on the column?
>Steve,
>If this will only be used in one column no need to create a class, just go and edit that column.text1's gotfocus, lostfocus.
>Otherwise create the class, drop on to the columns that it will be used and delete default control text1 (or set currentcontrol="myTextbox1"). Preferably add a property as savemask to class so your inputmask would be more generic (not constant as 999,999.99):define class myTextbox as Textbox
>savemask = .f.
>procedure init
>this.savemask = this.inputmask
>endproc
>procedure gotfocus
>this.inputmask = chrtran(this.inputmask,",","") && remove commas
>endproc
>procedure lostfocus
>this.inputmask = this.savemask && Revert to saved mask
>endproc
>enddefineCetin

Cetin

Thanks for the advice.
Steve
Previous
Reply
Map
View

Click here to load this message in the networking platform