Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inputmask for numerics in grid column
Message
From
22/12/2004 10:06:33
 
 
To
21/12/2004 19:55:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00971208
Message ID:
00971416
Views:
26
I have a numeric column in a grid. I'd like the values to display using a value for inputmask of '9,999,999'.

However, the user can modify the data in this column, and the inputmask really screws things up when the user tries using the keyboard.


Leave the InputMask on the column as '9,999,999'. That way, all the text boxes that do not have focus will be formatted nicely.

Next, create a numeric text box class for use in your grid and drop it in to the appropriate column. Add a custom property called cOldInputMask to the class. This code in the GotFocus()
WITH This
  *** Save the original input mask
  .cOldInputMask = .InputMask
  *** Remove separators from input mask
  .InputMask = STRTRAN( .cOldInputMask, ',', '' )
  *** Perform The parent class behavior
  DODEFAULT()
ENDWITH
And this code in the LostFocus()
This.InputMask = This.cOldInputMask
Previous
Reply
Map
View

Click here to load this message in the networking platform