I've been experiment with UltraNumericEditor and having no success. It MinValue validation occurs with every keystroke, so if you set a min value of 10, the editor is unusuable if you try to type in it. I am also unable to get the button to show up for incrementing the number up or down.
Any suggestions?
tribbles said:I've been experiment with UltraNumericEditor and having no success. It MinValue validation occurs with every keystroke, so if you set a min value of 10, the editor is unusuable if you try to type in it.
I just tested this out by placing a new UltraNumericEditor control on a form and setting it's MinValue to 10 and I have no problem typing into the control.
tribbles said:I am also unable to get the button to show up for incrementing the number up or down.
Set the SpinButtonDisplayStyle property.
Try it again embedded in a tree control cell and you'll see what I am talking about. The behavior of the editor is different between a form and embedding in a tree control. I'm guessing there has to be some property or set of properties I need to change to get the form behavior to occur in the tree control...
I am finding I am getting wierd current value objects in the CellValueCHanged event. I've done a couple of things that have helped greating with the exception storm I was getting.... The first was to get a new instance of the numeric control for every cell that I assign an editor. This fixed the problem where is seemed that the last numeric editor configured min/max values was in effect for all cells. The 2nd was to add a line of code to the cell valeu change event to ignore bad values...
private void ultraTreeFields_CellValueChanged(object sender, CellValueChangedEventArgs e) { if (!e.IsValid || e.CurrentValue is System.DBNull) return;
This has stopped the exception storm and the editor is finally stable, but in an unexpected way... I am able to leave a cell with an invalid numeric value which is troublesome... I am setting nullable to false so there should always be a numeric value in the cell and I am expecting that value to be the min allowed value, i.e. the behavior of the MS numeric control. Instead I can get null or 0 as a value in the control, instead of the min value of 5 in my 1 test case. Below is the code I use to generate the initial numeric editor for embedding. I posted the setting of the min/max value above. If I type in a number lower than the min the editor shows no value. If I then tab out I get either nothing or a zero. Expected behavior would be the min value or reset to the original value or possibly trap the user until a valid value is entered...
private UltraNumericEditor GenerateNumericEditor() { UltraNumericEditor numericEditor = new UltraNumericEditor(); // // Set some default behaviors for the numeric editor we'll use in our cells. // numericEditor.NumericType = NumericType.Integer; numericEditor.PromptChar = ' '; numericEditor.SpinButtonDisplayStyle = ButtonDisplayStyle.OnMouseEnter; numericEditor.Nullable = false;
return numericEditor; }
The specific test case used. MinValue = 10, MaxValue = 2000. In the control I type 12, then hit backspace twice then tab out. The result is usually a System.DBNull for the cell when the expected value is 10 or the old value of 2000. Occasionally I also get a 0. Not sure why...