I have a request to display and accept negative numbers as numbers with parenthesis, for example, (450) represents -450
Does InputMask property support parenthesis in mask?
Please help ...
My team and I have done an initial review of this issue, and I am a little unsure of what exactly you are looking to achieve. I have looked through our Windows Forms APIs and have not found any trace of an ITreeNodeColumn, and so I am not entirely sure what exactly that is. From your description, though, it sounds like you are looking to apply a Mask where if the value is within parenthesis, the editor that you are applying it to will evaluate it as a negative value?
If this is the case, this is not supported out of the box. There is no Mask that I know of that will allow you to have an input in parenthesis and evaluate that as a negative number.
I did notice that the UltraTextEditor is tagged in this forum thread. If you are using an UltraTextEditor, I don’t believe you will be able to apply a Mask anyway, as this editor cannot be masked. Assuming you are using this editor type, my best recommendation in this case would be to handle the ValueChanged event and parse the Value of the UltraTextEditor. If it is contained in parenthesis, set the Value of the editor to be the negative value of what is within those parenthesis.
Please let me know if you have any other questions or concerns on this matter.
Just to clarify a little bit.
If you are using Windows Form UltraTree, then you can format numeric values using parentheses for negative number. But this is a function of the DotNet framework and it's not really anything to do with the tree - except that the tree column exposes a format property and you can assign a format that gets passed into the ToString method of the cell's value when it's displayed.
Format only applies applies to the display of a cell when it is NOT in edit mode.
Masking only applies when the cell IS in edit mode. There's no way to specify a mask that takes parens for negative numbers. Bu in theory, you could use an UltraTextEditor with a DataFilter to convert "(55)" into -55 and vice versa. You would have to write the code to parse the string values and turn them into a numeric value, though.
Hi Andrew, sorry for the confusion, yes you are correct, ITreeNodeColumn is not part of Infragistics. But we do use Infragistics.Win.UltraWinTree.UltraTree class. And I think when we execute SetDataBinding, all the cells in the tree are built with types that match the datasource field types. Once the cell types are defined, it would not allow me to put a custom mask such as parenthesis on a decimal cell type. If only there was a way to override these cell types then I may be able to override and define some cell as string and then put my custom mask on numeric types. Or,is there a better approach to applying custom mask in numeric cells?
Thank you Mike, I think the problem is with the cell being defined as a type that matches the datasource field. So, once a cell is defined as decimal, then applying parenthesis would not comply with numeric standards.
Perhaps there is something in Infragistics that I'm not aware of, to handle this kind of situation?
I'm afraid you lost me. You are correct that the column's DataType will pick up the DataType of the field in the data source. If you want to format the data in the tree, there's a Format property on the column. As I said, the tree basically just takes that format and passes it into the ToString method of the cell's value and uses that string in the display of the cell. So you can use any format that the DotNet framework supports for the DataType of your data.
Standard Numeric Format Strings
Custom Numeric Format Strings