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:33:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
25/11/1998 11:23:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00161392
Message ID:
00161416
Views:
20
>>>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
enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform