Hello together!
I need to have a numerical editor which does cover the range from minimal 100 to maximal 15000 in steps of 100 with a spin button and as user entry over the keyboard.First I tried an UltraNumericEditor which is working fine, but the user can enter values like 12385. I found no input mask which forces the entry to xxx00.
Then I tried an UltraMaskedEdit and used an input mask ‘nnn00’. This works quite well, but if the user is typing in 15000 the UltraMaskedEdit shows only 1500. The problem with this mask is any occurrence of a zero in the user input.
So please has anybody a good idea for an input mask which is solving the demand?
I’m using: Infragistics4.Win.UltraWinMaskedEdit.v15.2 15.2.20152.2023I have attached a simple example which shows both controls.
Thank you very much for any suggestion!
RegardsFrank
Hi Frank, Instead of the ValueChanged event, there is also the [Before|After]ExitEditMode events. Or if you have the AlwaysInEditMode property set to true, you can use the LostFocus or Validating events. All of those trigger when the editor loses focus. Which would likely be the ideal time to round the values.
Let me know if that helps,
Hi Josheela,
Thank you very much for your suggestions.
ultraNumericEditor1.Value = Math.Round(nValue / 100d, 0) * 100;
I have already this rounding solution in my real application. The only disadvantage is that the updated value is only getting visible if the ultraNumericEditor1 is losing the input focus. The main problem from the view of the programmer is, that we don’t really know when the user has competed his input.
I am still hoping that we can find an input mask which can solve this in a more elegant way.
Best regardsFrank
One option, is to use the same Numeric Editor and validate the value user enters and round it to the nearest 100's. For that all you need to do is update the ultraNumericEditor1_ValueChanged event with one line of code as,
private void ultraNumericEditor1_ValueChanged( object sender, EventArgs e ){ if( ultraNumericEditor1 != null ) { int nValue = SaveObject2Int32(ultraNumericEditor1.Value); f (nValue > 0) { DebugWriteLine(nValue.ToString()); } ultraNumericEditor1.Value = Math.Round(nValue / 100d, 0) * 100; }}
Thanks,Josheela
'nnn00' is one of the most appropriate mask, to work along with the Spin Increment where numbers can be entered from right to left and no empty place holders are kept in between for missing numbers.
Having # or 9 in place of n, keep empty spaces as place holders for digits and numbers are entered from left to right which makes it hard to spin increment and type in values.
I will also be enquiring more on this and will update you if I have a better answer.