I have an input screen that allows users to type in stock prices. These still come in fractions in some cases, and the user would like to be able to type them in that way, with a space between the whole and fractional parts. I think I can do the parsing easily enough, but:
1) is there a mask that will allow this to be typed in? and still allow normal decimals?
2) what's a good place to trap the parsing before the normal code in UltraNumericEditor fires?
Maury
Maury Markowitz said:1) is there a mask that will allow this to be typed in? and still allow normal decimals?
No, I don't believe there is any mask that will allow you to so this.
Maury Markowitz said:2) what's a good place to trap the parsing before the normal code in UltraNumericEditor fires?
Normally, you would use a DataFilter for this. But I don't think the DataFilter will fire the conversions you would need here. The masked editors do not allow you to format the data when going from the editor to the display because the display has to fit the mask.
Any other suggestions then? I can do without the mask (in fact the users don't seem to like the UI for it). Can you think of a way I could do this with one of the other editors?
Sure. If you don't want to use a mask, it's pretty easy. You would just use an EditorWithText (or UltraTextEditor control) and attach a DataFilter to it. The DataFilter allows you to handle the conversion when the value is transferred from the display (the screen) to the editor to the owner (the grid in this case).
So in your case, you would just need to handle the DisplayToEditor conversion and translate the fraction into a decimal.