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?
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...
My setting on the numeric editor are:
// // Set some default behaviors for the numeric editor we'll use in our cells. // ultraNumericEditor.NumericType = NumericType.Integer; ultraNumericEditor.PromptChar = ' '; ultraNumericEditor.SpinButtonDisplayStyle = ButtonDisplayStyle.OnMouseEnter;
I don't get any buttons when I click on the cell. If I set it to always, I will get button, but then my row doesn't get selected.
The logic I use for settign the min/max values on the controls are:
// // Get our numeric control for editing overrides // UltraNumericEditor minLenIntCtrl = node.Cells["Override Min Length"].EditorControl as UltraNumericEditor; UltraNumericEditor maxLenIntCtrl = node.Cells["Override Max Length"].EditorControl as UltraNumericEditor;
if (minLenIntCtrl != null && maxLenIntCtrl != null) { // // Configure our numeric controls // minLenIntCtrl.MinValue = field.MinLength; minLenIntCtrl.MaxValue = overrideField.MaxLength; minLenIntCtrl.Value = overrideField.MinLength; node.Cells["Override Min Length"].Value = overrideField.MinLength;
maxLenIntCtrl.MinValue = overrideField.MinLength; maxLenIntCtrl.MaxValue = field.MaxLength; maxLenIntCtrl.Value = overrideField.MaxLength; node.Cells["Override Max Length"].Value = overrideField.MaxLength; }
I'm not sure exactly what is goign on, but I think the min/max value properties are getting corrupted across all the cells. The same logic using MS control on a form works perfectly, but within your control embedded in a tree does not act in any predictable way...
It nice your controls have so many features... But man, nothing works intuitively. After 3 years of using your control suite, it still frustrates me to work with them. :(
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...
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.