Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble w/ inputmask & cursor controlsource
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00158627
Message ID:
00159229
Views:
26
Thanks again




>Just multiply the number by 10 or 100 then use INT(). For example, this will check for one or two decimal places:
>
>IIF(MyField=INT(MyField),"99999", ;
>   IIF(MyField*10=INT(MyField*10),"99999.9","99999.99"))
>
>>Thanks guys, the dynamicinputmask worked for me. Just curious, what would the next iif line be to check if 2, and then 3, decimal places are used? I see how the INT function identifies no decimals but what function(s)can check the amount of digits to the right of decimal? Thanks
>>
>>
>>>Allen,
>>>
>>>You need the DynamicInputMask property of the column. For example, to set the input mask to show no decimal places for a whole number and 1 for other numbers, use this:
>>>
>>>mygrid.column1.DynamicInputMask='IIF(MyField=INT(MyField),"99999","99999.9")'
>>>
>>>You can nest IIF's to handle 2 or 3 decimal places. You could also create a function or class to deal with it and call that from the DynamicInputMask. The function would just return the appropriate mask.
>>>
>>>>Hi,
>>>>
>>>>Can anyone tell me how to set a format/inputmask for a textbox(in a grid) that has it's controlsource set as a cursor.
>>>>Here's what happens:
>>>>
>>>>If I set this.grid.txtBox.controlsource='mycursor.myfield' and set the field type to N(7,3), the displayed number will show as 99999.999.
>>>>The problem I have is I want the display to show 999999 if .000 are the trailing numbers. But it displays as 99999.000.
>>>>If I enter for example 10.5 I want 10.5 but I get 10.500. I need up to 3 decimal places for this value but I don't want them displayed if it's zeros.
>>>>
>>>>The format property T (removes leading and trailing blanks) is sortof the property I'm looking for but that doesn't work here.
>>>>Is there a way to have the inputmask and format properties adjust a control whose controlsource is a cursor's field? I can't seem to get it to work.
>>>>
>>>>Thanks for any help
>>>>Allen
Previous
Reply
Map
View

Click here to load this message in the networking platform