Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1725
WinValidators with grid numeric editors
posted

I'm trying to get the new 8.2 validators to work in some way that makes sense and (so far) without any luck.

What I have is a grid with multiple columns each with an assigned numeric editor. The editor has both right and left button collections (if that matters here). What I am trying to do is to (a) only show a validation error when the user exits edit mode on the editor (normally by tabbing out of the cell) and to show the user a "tip" that describes the error.Sounded "easy". The code I have is the following 

UltraNumericEditor numericEditor = new UltraNumericEditor();

numericEditor.AfterEditorButtonCloseUp += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.normalNumericEditor_AfterEditorButtonCloseUp);
numericEditor.BeforeEditorButtonDropDown += new Infragistics.Win.UltraWinEditors.BeforeEditorButtonDropDownEventHandler(this.normalNumericEditor_BeforeEditorButtonDropDown);
numericEditor.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.TasterResponseForm_HelpRequested);
numericEditor.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.normalNumericEditor_EditorButtonClick);
gridColumn.EditorControl = numericEditor;
ValidationSettings validationSettings = cellValidator.GetValidationSettings(numericEditor);
RangeCondition rangeCondition = validationSettings.Condition as RangeCondition;
if (null == rangeCondition)
{
    rangeCondition = new RangeCondition();
    rangeCondition.DataType = typeof(double);
    validationSettings.Condition = rangeCondition;
    validationSettings.IsRequired = false;
    validationSettings.NotificationSettings.Action = NotificationAction.Image; //NotificationAction.BalloonTip;
    validationSettings.ValidationTrigger = ValidationTrigger.OnValidating;
    validationSettings.RetainFocusOnError = true;
    validationSettings.NotificationSettings.Caption = "Validation Caption";
    validationSettings.NotificationSettings.Text = "Your value is bogus";
}
rangeCondition.MinimumValue = question.MinValue;
rangeCondition.MaximumValue = question.MaxValue; 

This is run against each of the columns during the grid initializelayout event.

I also have hooked up the validator Validating and ValidationError events to see what happens.

The result of the above is not what I want in a couple of ways

1)  The image (red x) is displayed in the cell as soon as the user types anything into the editor. This appears to be triggered by the property update (I'm assuming) and is not what I want to see (although the validation results..that is giving me the indication when the value exceeds the maximim as I'm typing away).

2)  There is no way that I can find to get any type of tip related to the error. If I set the notification action to MessageBox I do get a message box but that notification type is rather "rude" and I need to be able to mouse over the indication or get a balloon tip or something less anoying. 

What I also find is that the Validating and Validation error events are only being fired (as I expected) when the editor/cell is validated which (as I said in 1) is when I expected to see any validation error indications.

Am I just missing it?

Neil

Parents
No Data
Reply
  • 69832
    Offline posted

    1) When using the notification action of 'Image' for a grid cell, the valid state of the cell's value is depicted at all times. This is a necessary limitation based on the fact that the validator uses the Infragistics Appearance model for the 'Image' setting (the Image property of the cell's appearance is resolved differently when the value is not valid). In this sense, the ValidationTrigger is not applicable with regard to when the error image is displayed.

    2) You might want to consider setting the notification action to 'BalloonTip' instead. Since you are setting RetainFocusOnError to true, focus will be retained by the cell when validation fails, so you can use this setting (you can't always with embeddable editors). This setting will display the values of the Caption/Text property.

    Note that I discovered a bug while investigating this, whereby the balloon tip does not point to the cell as it should. This will be addressed in a future release; you might want to report that issue if you want to receive a notification when the fix becomes available.

Children