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 Josheela,
Thank you very much for your example.
While testing the example I found to things. The two ending zeros are vertically misaligned and do have a different color color when they are selected compared to the other numbers.If the caret is set between the two zeros the spin buttons are getting disabled and a spinning is not anymore possible. We need to set first the caret in the left hand side of the two zeros, then the spin buttons are getting enabled again.
Thank you 1000 times!
Frank
I am attaching a sample with the solution.
Thanks
Hi Mike
I did try to follow your suggestion with the draw filter but I did not find out how to draw the “0” instead of “~” for the given input mask “nnn~~”.How do I get the right object for the replacing of the characters inside the DrawElement method?
public bool DrawElement( Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams )Can this be a way?
UIElement hElement = drawParams.Element;MaskedEditControlUIElement hff = hUIElement as MaskedEditControlUIElement;.......
At the moment this is the code in the DrawElement method.
public bool DrawElement( DrawPhase drawPhase, ref UIElementDrawParams drawParams ){ string strGet = ultraMaskedEdit1.Text; string strOut = DoReplaceThisChar( strGet, "~" ); //ultraMaskedEdit1.Value = strOut; // this does not work! InfoMessage( "original={0} strOut={1}", strGet, strOut ); return( true );}
InfoMessage shows:original=145~~ strOut=14500
Thank you very much!
Hi Frank,
The reason why the "nnn00" won't work is based on how the UltraMaskedEditor looks at the 0's as literals. Similar to dashes in a IP Address so in that scenario when you type a period (.) that matches the next literal it skips to the next section. In this case when you try to type 15000, the first zero you type matches the literal '0' in your mask. There in lies the problem that you are facing.http://ko.infragistics.com/help/winforms/infragistics4.win.ultrawinmaskededit.v16.2~infragistics.win.ultrawinmaskededit.ultramaskededit~inputmask Since you want static zero's and not just a guaranteed to display character like $9990.00 where typing .1 will display $0.10. In that scenario they are just placeholders, that fill in the value zero if you don't otherwise have a value. But you specifically want the value "00". The three resolutions, that I think have the best resolution would be one, the BeforeExitEditMode, round the value. Drawback,end user would likely want some notification of the rounding, which you could display somewhere but may not be the ideal UI.Second validating, if the value includes zeros you can flip a data error flag. End user gets notification of the why, but may not like the display style.Third would take more coding, but you can fake it, by making the mask something like nnn~~ or some other unlikely character. Then you can create a DrawFilter that paints the '0' in place of the other character. Additionally I believe you will likely need to do either a dataFilter, to handle the data conversion of the editor string value of 150~~ to\from integer value 15000 of the underlying datasource. You could probably also use the before[Enter|exit]editmode events to do the same effect.
http://help.infragistics.com/Help/Doc/WinForms/2012.2/CLR4.0/HTML/Win_Draw_Filter.htmlhttp://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=5014Let me know if that helps,
Hi Michael
The events BeforeExitEditMode, AfterExitEditMode and Validating do all occur when the ultraNumericEditor control has lost its input focus. One possibility would be starting a timer after the ValueChanged event and then guessing let’s say after 10 seconds this was the last user input key stroke and then doing the rounding. But we do all know this is not a good solution.
If the ultraNumericEditor would allow an input mask like “nnn00” then it would be solved. But the Visual Studio tells me: “The specified mask is not compatible with the current value of the 'NumericType' property.”
Thank you very much for your suggestions!