Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
InputMask problem when entering small number.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00109770
Message ID:
00111320
Vues:
29
>>>>>>>I have a numeric field with the input mask of 99,999.99. When I create a new record and enter that field, if I type "100.00" it comes out fine. But if I type "1.00" it comes out at "10.00". I have tried many things to compensate but cannot get it to enter correctly. I would think as soon as you type the decimal it would know that you typed "1." not "10." Is this a bug?
>>>>>>
>>>>>>Set format property to "K" to make it highlighted.
>>>>>
>>>>>That doesn't work. It's also right justified.
>>>>
>>>>It's a numeric field, so it should be right justified.
>>>
>>>Yes, I know, so is the a VFP bug? Not the right justification, but the number being enter with an extra 0?
>>
>>
>>I am not so sure if this is a known bug. Actually w/o the inputmask setting it's quite OK, but whether a known bug or not, what we are doing is we set the Format property to "K" or the selectonentry to .T., and at WHEN event, we issued KEYBOARD "{SHIFT+END}" to force it selected when using the mouse in focusing the object.
>
>
>Try putting this code in Gotfocus
> This.InputMask = " 99999.99"
>
>And in LostFoucus Try
> This.InputMask = " 99,999.99"

I was getting this problem even within a field that was defined as 99.99
Just last night I figured out a fix...
In the GotFocus method I put this:
DODEFAULT()
IF THIS.Value = .NULL. OR THIS.Value = 0
KEYBOARD '0.' + '{BACKSPACE}'
ENDIF

This fixed the problem for me. When there is already a value, the problem doesn't occur, that's why I check for NULL or 0.

Dana
Where's the damned Any Key?...too late
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform