Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Round instead of truncate through InputMask property
Message
From
23/11/2006 10:04:11
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01171634
Message ID:
01172056
Views:
18
This message has been marked as the solution to the initial question of the thread.
>>>>>I use a double field with 15 decimals because I do unit conversions on the fly when the user changes the unit (droplist in another column).
>>>>>The DynanicInputMask Property of the column displaying the converted number depends on a mask assigned to the unit (ex:gal=999.9, lb=9999, kg=9999).
>>>>>The value gets truncated instead of rounded. (1.58156897 will display 1.5 instead of 1.6 for mask 999.9)
>>>>>My column is bound to my field ans I don't want my field value to be rounded, just "displayed" as rounded.
>>>>>
>>>>>Thanks for your help.
>>>>
>>>>InputMask,trasform(),... truncated the number by design,
>>>>because the C++ code, first build the number string in full mode,
>>>>after it apply the mask.
>>>>
>>>>If the cell is not editable, then you can output an expression
>>>>
>>>>column.controlsource="(ROUND(fieldnumber,dynamicround)"
>>>>
>>>>
>>>>if the cell is editable, a solution exists ( not checked ):
>>>>
>>>>column.bound=.F.
>>>>column.Sparse=.T.
>>>>column.controlsource="(ROUND(fieldnumber,dynamicround))"
>>>>column.DynanicInputMask = "..."
>>>>
>>>>column.text1.Controlsource = ""
>>>>
>>>>column.text1.GotFocus
>>>>
>>>>this.InputMask = "...."
>>>>this.Value = ROUND(fieldnumber,dynamicround)
>>>>
>>>>column.text1.Valid
>>>>
>>>>replace field with m.this.Value
>>>>
>>>>....
>>>>
>>>
>>>I did exactly what you suggested. The display is ok, but the cell is not editable, probably because the controlsource of the column is a function...any idea?
>>
>>use my second suggestion.
>
>That's exactly what I did since I needed editing. I can't edit.

Sorry, I forgot this.

Use this:
* use a textbox subclass with

PROCEDURE ReadOnly_Assign(nv)
* this.ReadOnly = m.nv
ENDPROC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform